Factor //wmaker:{cursor,geometry,preferences} into distinct libs.

This commit is contained in:
2025-02-09 10:28:29 -05:00
parent 3278af0885
commit 949ac920ce
6 changed files with 269 additions and 218 deletions
+28
View File
@@ -4,6 +4,34 @@ cc_library(
visibility = ["//visibility:public"],
)
cc_library(
name = "wconfig",
hdrs = ["wconfig.h"],
)
cc_library(
name = "cursor",
hdrs = ["cursor.h"],
)
cc_library(
name = "geometry",
hdrs = ["geometry.h"],
)
cc_library(
name = "preferences",
hdrs = ["preferences.h"],
srcs = ["preferences.c"],
deps = [
":cursor",
":geometry",
":wconfig",
"//wrlib",
"//WINGs",
],
)
# TODO: factor this apart into at least 1 library. (Shared functions defined in
# main.c will have to go elsewhere.)
cc_binary(
-218
View File
@@ -103,30 +103,6 @@ typedef struct WObjDescriptor {
#define PRED_BPIXMAPS 4 /* count of WBUT icons */
#endif /* XKB_BUTTON_HINT */
/* Mouse cursors */
typedef enum {
WCUR_NORMAL,
WCUR_MOVE,
WCUR_RESIZE,
WCUR_TOPLEFTRESIZE,
WCUR_TOPRIGHTRESIZE,
WCUR_BOTTOMLEFTRESIZE,
WCUR_BOTTOMRIGHTRESIZE,
WCUR_VERTICALRESIZE,
WCUR_HORIZONRESIZE,
WCUR_WAIT,
WCUR_ARROW,
WCUR_QUESTION,
WCUR_TEXT,
WCUR_SELECT,
WCUR_CAPTURE,
WCUR_ROOT,
WCUR_EMPTY,
/* Count of the number of cursors defined */
WCUR_LAST
} w_cursor;
/* geometry displays */
#define WDIS_NEW 0 /* new style */
#define WDIS_CENTER 1 /* center of screen */
@@ -307,200 +283,6 @@ enum {
typedef struct {
int x1, y1;
int x2, y2;
} WArea;
typedef struct WCoord {
int x, y;
} WCoord;
extern struct WPreferences {
char *pixmap_path; /* : separated list of paths to find pixmaps */
char *icon_path; /* : separated list of paths to find icons */
WMArray *fallbackWMs; /* fallback window manager list */
char *logger_shell; /* shell to log child stdi/o */
RImage *button_images; /* titlebar button images */
char smooth_workspace_back;
signed char size_display; /* display type for resize geometry */
signed char move_display; /* display type for move geometry */
signed char window_placement; /* window placement mode */
signed char colormap_mode; /* colormap focus mode */
signed char focus_mode; /* window focusing mode */
char opaque_move; /* update window position during move */
char opaque_resize; /* update window position during resize */
char opaque_move_resize_keyboard; /* update window position during move,resize with keyboard */
char wrap_menus; /* wrap menus at edge of screen */
char scrollable_menus; /* let them be scrolled */
char vi_key_menus; /* use h/j/k/l to select */
char align_menus; /* align menu with their parents */
char use_saveunders; /* turn on SaveUnders for menus, icons etc. */
char no_window_over_dock;
char no_window_over_icons;
WCoord window_place_origin; /* Offset for windows placed on screen */
char constrain_window_size; /* don't let windows get bigger than screen */
char windows_cycling; /* windoze cycling */
char circ_raise; /* raise window after Alt-tabbing */
char ignore_focus_click;
char open_transients_with_parent; /* open transient window in same workspace as parent */
signed char title_justification; /* titlebar text alignment */
int window_title_clearance;
int window_title_min_height;
int window_title_max_height;
int menu_title_clearance;
int menu_title_min_height;
int menu_title_max_height;
int menu_text_clearance;
char multi_byte_text;
#ifdef KEEP_XKB_LOCK_STATUS
char modelock;
#endif
char no_dithering; /* use dithering or not */
char no_animations; /* enable/disable animations */
char no_autowrap; /* wrap workspace when window is moved to the edge */
char window_snapping; /* enable window snapping */
int snap_edge_detect; /* how far from edge to begin snap */
int snap_corner_detect; /* how far from corner to begin snap */
char snap_to_top_maximizes_fullscreen;
char drag_maximized_window; /* behavior when a maximized window is dragged */
char move_half_max_between_heads; /* move half maximized window between available heads */
char alt_half_maximize; /* alternative half-maximize feature behavior */
char pointer_with_half_max_windows;
char highlight_active_app; /* show the focused app by highlighting its icon */
char auto_arrange_icons; /* automagically arrange icons */
char icon_box_position; /* position to place icons */
signed char iconification_style; /* position to place icons */
char disable_root_mouse; /* disable button events in root window */
char auto_focus; /* focus window when it's mapped */
char *icon_back_file; /* background image for icons */
char enforce_icon_margin; /* auto-shrink icon images */
WCoord *root_menu_pos; /* initial position of the root menu*/
WCoord *app_menu_pos;
WCoord *win_menu_pos;
signed char icon_yard; /* aka iconbox */
int raise_delay; /* delay for autoraise. 0 is disabled */
int cmap_size; /* size of dithering colormap in colors per channel */
int icon_size; /* size of the icon */
signed char menu_style; /* menu decoration style */
signed char workspace_name_display_position;
unsigned int modifier_mask; /* mask to use as kbd modifier */
char *modifier_labels[7]; /* Names of the modifiers */
unsigned int supports_tiff; /* Use tiff files */
char ws_advance; /* Create new workspace and advance */
char ws_cycle; /* Cycle existing workspaces */
char save_session_on_exit; /* automatically save session on exit */
char sticky_icons; /* If miniwindows will be onmipresent */
char dont_confirm_kill; /* do not confirm Kill application */
char disable_miniwindows;
char enable_workspace_pager;
char ignore_gtk_decoration_hints;
char dont_blink; /* do not blink icon selection */
char keep_dock_on_primary_head; /* keep dock on primary head */
/* Appearance options */
char new_style; /* Use newstyle buttons */
char superfluous; /* Use superfluous things */
/* root window mouse bindings */
signed char mouse_button1; /* action for left mouse button */
signed char mouse_button2; /* action for middle mouse button */
signed char mouse_button3; /* action for right mouse button */
signed char mouse_button8; /* action for 4th button aka backward mouse button */
signed char mouse_button9; /* action for 5th button aka forward mouse button */
signed char mouse_wheel_scroll; /* action for mouse wheel scroll */
signed char mouse_wheel_tilt; /* action for mouse wheel tilt */
/* balloon text */
char window_balloon;
char miniwin_title_balloon;
char miniwin_preview_balloon;
char appicon_balloon;
char help_balloon;
/* some constants */
int dblclick_time; /* double click delay time in ms */
/* animate menus */
signed char menu_scroll_speed; /* how fast menus are scrolled */
/* animate icon sliding */
signed char icon_slide_speed; /* icon slide animation speed */
/* shading animation */
signed char shade_speed;
/* bouncing animation */
char bounce_appicons_when_urgent;
char raise_appicons_when_bouncing;
char do_not_make_appicons_bounce;
int edge_resistance;
int resize_increment;
char attract;
unsigned int workspace_border_size; /* Size in pixels of the workspace border */
char workspace_border_position; /* Where to leave a workspace border */
char single_click; /* single click to lauch applications */
int history_lines; /* history of "Run..." dialog */
char cycle_active_head_only; /* Cycle only windows on the active head */
char cycle_ignore_minimized; /* Ignore minimized windows when cycling */
char double_click_fullscreen; /* Double click on titlebar maximize a window to full screen*/
char close_rootmenu_left_right_click;/* Close application menu when mouse (left or right) is clicked outside focus */
char strict_windoze_cycle; /* don't close switch panel when shift is released */
char panel_only_open; /* Only open the switch panel; don't switch */
int minipreview_size; /* Size of Mini-Previews in pixels */
/* All delays here are in ms. 0 means instant auto-action. */
int clip_auto_raise_delay; /* Delay after which the clip will be raised when entered */
int clip_auto_lower_delay; /* Delay after which the clip will be lowered when leaved */
int clip_auto_expand_delay; /* Delay after which the clip will expand when entered */
int clip_auto_collapse_delay; /* Delay after which the clip will collapse when leaved */
RImage *swtileImage;
RImage *swbackImage[9];
union WTexture *wsmbackTexture;
char show_clip_title;
char hot_corners; /* let corners execute actions */
int hot_corner_delay; /* Delay after which the hot corner is triggered */
int hot_corner_edge; /* Hot corner edge size */
char *hot_corner_actions[4]; /* Action of each corner */
struct {
#ifdef USE_ICCCM_WMREPLACE
unsigned int replace:1; /* replace existing window manager */
#endif
unsigned int nodock:1; /* don't display the dock */
unsigned int noclip:1; /* don't display the clip */
unsigned int clip_merged_in_dock:1; /* disable clip, switch workspaces with dock */
unsigned int nodrawer:1; /* don't use drawers */
unsigned int wrap_appicons_in_dock:1; /* Whether to wrap appicons when Dock is moved up and down */
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
unsigned int noautolaunch:1; /* don't autolaunch apps */
unsigned int norestore:1; /* don't restore session */
unsigned int restarting:2;
} flags; /* internal flags */
/* Map table between w_cursor and actual X id */
Cursor cursor[WCUR_LAST];
int switch_panel_icon_size; /* icon size in switch panel */
} wPreferences;
/****** Global Variables ******/
extern Display *dpy;
+28
View File
@@ -0,0 +1,28 @@
#ifndef CURSOR_H_
#define CURSOR_H_
/* Mouse cursors */
typedef enum {
WCUR_NORMAL,
WCUR_MOVE,
WCUR_RESIZE,
WCUR_TOPLEFTRESIZE,
WCUR_TOPRIGHTRESIZE,
WCUR_BOTTOMLEFTRESIZE,
WCUR_BOTTOMRIGHTRESIZE,
WCUR_VERTICALRESIZE,
WCUR_HORIZONRESIZE,
WCUR_WAIT,
WCUR_ARROW,
WCUR_QUESTION,
WCUR_TEXT,
WCUR_SELECT,
WCUR_CAPTURE,
WCUR_ROOT,
WCUR_EMPTY,
/* Count of the number of cursors defined */
WCUR_LAST
} w_cursor;
#endif // CURSOR_H_
+13
View File
@@ -0,0 +1,13 @@
#ifndef WGEOMETRY_H_
#define WGEOMETRY_H_
typedef struct {
int x1, y1;
int x2, y2;
} WArea;
typedef struct WCoord {
int x, y;
} WCoord;
#endif // WGEOMETRY_H_
+3
View File
@@ -0,0 +1,3 @@
#include "wmaker/preferences.h"
struct WPreferences wPreferences;
+197
View File
@@ -0,0 +1,197 @@
#ifndef WPREFERENCES_H_
#define WPREFERENCES_H_
#include "wmaker/wconfig.h"
#include "wmaker/cursor.h"
#include "wmaker/geometry.h"
#include "wrlib/wraster.h"
#include "WINGs/WUtil.h"
extern struct WPreferences {
char *pixmap_path; /* : separated list of paths to find pixmaps */
char *icon_path; /* : separated list of paths to find icons */
WMArray *fallbackWMs; /* fallback window manager list */
char *logger_shell; /* shell to log child stdi/o */
RImage *button_images; /* titlebar button images */
char smooth_workspace_back;
signed char size_display; /* display type for resize geometry */
signed char move_display; /* display type for move geometry */
signed char window_placement; /* window placement mode */
signed char colormap_mode; /* colormap focus mode */
signed char focus_mode; /* window focusing mode */
char opaque_move; /* update window position during move */
char opaque_resize; /* update window position during resize */
char opaque_move_resize_keyboard; /* update window position during move,resize with keyboard */
char wrap_menus; /* wrap menus at edge of screen */
char scrollable_menus; /* let them be scrolled */
char vi_key_menus; /* use h/j/k/l to select */
char align_menus; /* align menu with their parents */
char use_saveunders; /* turn on SaveUnders for menus, icons etc. */
char no_window_over_dock;
char no_window_over_icons;
WCoord window_place_origin; /* Offset for windows placed on screen */
char constrain_window_size; /* don't let windows get bigger than screen */
char windows_cycling; /* windoze cycling */
char circ_raise; /* raise window after Alt-tabbing */
char ignore_focus_click;
char open_transients_with_parent; /* open transient window in same workspace as parent */
signed char title_justification; /* titlebar text alignment */
int window_title_clearance;
int window_title_min_height;
int window_title_max_height;
int menu_title_clearance;
int menu_title_min_height;
int menu_title_max_height;
int menu_text_clearance;
char multi_byte_text;
#ifdef KEEP_XKB_LOCK_STATUS
char modelock;
#endif
char no_dithering; /* use dithering or not */
char no_animations; /* enable/disable animations */
char no_autowrap; /* wrap workspace when window is moved to the edge */
char window_snapping; /* enable window snapping */
int snap_edge_detect; /* how far from edge to begin snap */
int snap_corner_detect; /* how far from corner to begin snap */
char snap_to_top_maximizes_fullscreen;
char drag_maximized_window; /* behavior when a maximized window is dragged */
char move_half_max_between_heads; /* move half maximized window between available heads */
char alt_half_maximize; /* alternative half-maximize feature behavior */
char pointer_with_half_max_windows;
char highlight_active_app; /* show the focused app by highlighting its icon */
char auto_arrange_icons; /* automagically arrange icons */
char icon_box_position; /* position to place icons */
signed char iconification_style; /* position to place icons */
char disable_root_mouse; /* disable button events in root window */
char auto_focus; /* focus window when it's mapped */
char *icon_back_file; /* background image for icons */
char enforce_icon_margin; /* auto-shrink icon images */
WCoord *root_menu_pos; /* initial position of the root menu*/
WCoord *app_menu_pos;
WCoord *win_menu_pos;
signed char icon_yard; /* aka iconbox */
int raise_delay; /* delay for autoraise. 0 is disabled */
int cmap_size; /* size of dithering colormap in colors per channel */
int icon_size; /* size of the icon */
signed char menu_style; /* menu decoration style */
signed char workspace_name_display_position;
unsigned int modifier_mask; /* mask to use as kbd modifier */
char *modifier_labels[7]; /* Names of the modifiers */
unsigned int supports_tiff; /* Use tiff files */
char ws_advance; /* Create new workspace and advance */
char ws_cycle; /* Cycle existing workspaces */
char save_session_on_exit; /* automatically save session on exit */
char sticky_icons; /* If miniwindows will be onmipresent */
char dont_confirm_kill; /* do not confirm Kill application */
char disable_miniwindows;
char enable_workspace_pager;
char ignore_gtk_decoration_hints;
char dont_blink; /* do not blink icon selection */
char keep_dock_on_primary_head; /* keep dock on primary head */
/* Appearance options */
char new_style; /* Use newstyle buttons */
char superfluous; /* Use superfluous things */
/* root window mouse bindings */
signed char mouse_button1; /* action for left mouse button */
signed char mouse_button2; /* action for middle mouse button */
signed char mouse_button3; /* action for right mouse button */
signed char mouse_button8; /* action for 4th button aka backward mouse button */
signed char mouse_button9; /* action for 5th button aka forward mouse button */
signed char mouse_wheel_scroll; /* action for mouse wheel scroll */
signed char mouse_wheel_tilt; /* action for mouse wheel tilt */
/* balloon text */
char window_balloon;
char miniwin_title_balloon;
char miniwin_preview_balloon;
char appicon_balloon;
char help_balloon;
/* some constants */
int dblclick_time; /* double click delay time in ms */
/* animate menus */
signed char menu_scroll_speed; /* how fast menus are scrolled */
/* animate icon sliding */
signed char icon_slide_speed; /* icon slide animation speed */
/* shading animation */
signed char shade_speed;
/* bouncing animation */
char bounce_appicons_when_urgent;
char raise_appicons_when_bouncing;
char do_not_make_appicons_bounce;
int edge_resistance;
int resize_increment;
char attract;
unsigned int workspace_border_size; /* Size in pixels of the workspace border */
char workspace_border_position; /* Where to leave a workspace border */
char single_click; /* single click to lauch applications */
int history_lines; /* history of "Run..." dialog */
char cycle_active_head_only; /* Cycle only windows on the active head */
char cycle_ignore_minimized; /* Ignore minimized windows when cycling */
char double_click_fullscreen; /* Double click on titlebar maximize a window to full screen*/
char close_rootmenu_left_right_click;/* Close application menu when mouse (left or right) is clicked outside focus */
char strict_windoze_cycle; /* don't close switch panel when shift is released */
char panel_only_open; /* Only open the switch panel; don't switch */
int minipreview_size; /* Size of Mini-Previews in pixels */
/* All delays here are in ms. 0 means instant auto-action. */
int clip_auto_raise_delay; /* Delay after which the clip will be raised when entered */
int clip_auto_lower_delay; /* Delay after which the clip will be lowered when leaved */
int clip_auto_expand_delay; /* Delay after which the clip will expand when entered */
int clip_auto_collapse_delay; /* Delay after which the clip will collapse when leaved */
RImage *swtileImage;
RImage *swbackImage[9];
union WTexture *wsmbackTexture;
char show_clip_title;
char hot_corners; /* let corners execute actions */
int hot_corner_delay; /* Delay after which the hot corner is triggered */
int hot_corner_edge; /* Hot corner edge size */
char *hot_corner_actions[4]; /* Action of each corner */
struct {
#ifdef USE_ICCCM_WMREPLACE
unsigned int replace:1; /* replace existing window manager */
#endif
unsigned int nodock:1; /* don't display the dock */
unsigned int noclip:1; /* don't display the clip */
unsigned int clip_merged_in_dock:1; /* disable clip, switch workspaces with dock */
unsigned int nodrawer:1; /* don't use drawers */
unsigned int wrap_appicons_in_dock:1; /* Whether to wrap appicons when Dock is moved up and down */
unsigned int noupdates:1; /* don't require ~/GNUstep (-static) */
unsigned int noautolaunch:1; /* don't autolaunch apps */
unsigned int norestore:1; /* don't restore session */
unsigned int restarting:2;
} flags; /* internal flags */
/* Map table between w_cursor and actual X id */
Cursor cursor[WCUR_LAST];
int switch_panel_icon_size; /* icon size in switch panel */
} wPreferences;
#endif // WPREFERENCES_H_