1
0
forked from vitrine/wmaker

10 Commits

22 changed files with 974 additions and 471 deletions

View File

@@ -1,13 +1,88 @@
package(default_visibility = ["//visibility:public"])
cc_library(
name = "appearance_settings",
hdrs = ["appearance_settings.h"],
)
cc_library(
name = "gnustep_compat",
hdrs = ["GNUstep.h"],
visibility = ["//visibility:public"],
)
cc_library(
name = "notifications",
hdrs = ["notifications.h"]
)
cc_library(
name = "globals",
hdrs = ["globals.h"],
srcs = ["globals.c"],
deps = ["@x11//:lib"],
)
cc_library(
name = "keybind",
hdrs = ["keybind.h"],
srcs = ["keybind.c"],
deps = ["@x11//:lib"],
)
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",
],
)
cc_library(
name = "resources",
hdrs = ["resources.h"],
srcs = ["resources.c"],
deps = [
":globals",
":wconfig",
"//wmaker/screen:interface",
"//wrlib",
"//WINGs",
"@x11//:lib",
],
)
cc_library(
name = "wconfig",
hdrs = ["wconfig.h"],
deps = ["//config"],
)
# TODO: factor this apart into at least 1 library. (Shared functions defined in
# main.c will have to go elsewhere.)
cc_binary(
name = "wmaker",
copts = [
"-DMAGICKCORE_HDRI_ENABLE=0",
"-DMAGICKCORE_QUANTUM_DEPTH=16",
"-DMAGICKCORE_CHANNEL_MASK_DEPTH=32",
],
srcs = [
"WindowMaker.h",
"actions.h",

View File

@@ -88,45 +88,6 @@ typedef struct WObjDescriptor {
void *parent; /* parent object (WWindow or WMenu) */
} WObjDescriptor;
/* internal buttons */
#define WBUT_CLOSE 0
#define WBUT_BROKENCLOSE 1
#define WBUT_ICONIFY 2
#define WBUT_KILL 3
#ifdef XKB_BUTTON_HINT
#define WBUT_XKBGROUP1 4
#define WBUT_XKBGROUP2 5
#define WBUT_XKBGROUP3 6
#define WBUT_XKBGROUP4 7
#define PRED_BPIXMAPS 8 /* reserved for 4 groups */
#else
#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 */
@@ -279,391 +240,6 @@ typedef enum {
#define WFLAGS_CRASHED (1<<0)
/* notifications */
#ifdef MAINFILE
#define NOTIFICATION(n) const char WN##n [] = #n
#else
#define NOTIFICATION(n) extern const char WN##n []
#endif
NOTIFICATION(WindowAppearanceSettingsChanged);
NOTIFICATION(IconAppearanceSettingsChanged);
NOTIFICATION(IconTileSettingsChanged);
NOTIFICATION(MenuAppearanceSettingsChanged);
NOTIFICATION(MenuTitleAppearanceSettingsChanged);
/* appearance settings clientdata flags */
enum {
WFontSettings = 1 << 0,
WTextureSettings = 1 << 1,
WColorSettings = 1 << 2
};
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;
extern struct wmaker_global_variables {
/* Tracking of the state of the program */
struct {
wprog_state state;
wprog_state signal_state;
} program;
/* locale to use. NULL==POSIX or C */
const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
/* ts on the last time we did XSetInputFocus() */
Time focus_change;
} timestamp;
/* Global Domains, for storing dictionaries */
struct {
/* Note: you must #include <defaults.h> if you want to use them */
struct WDDomain *wmaker;
struct WDDomain *window_attr;
struct WDDomain *root_menu;
} domain;
/* Screens related */
int screen_count;
/*
* Ignore Workspace Change:
* this variable is used to prevent workspace switch while certain
* operations are ongoing.
*/
Bool ignore_workspace_change;
/*
* Process WorkspaceMap Event:
* this variable is set when the Workspace Map window is being displayed,
* it is mainly used to avoid re-opening another one at the same time
*/
Bool process_workspacemap_event;
#ifdef HAVE_INOTIFY
struct {
int fd_event_queue; /* Inotify's queue file descriptor */
int wd_defaults; /* Watch Descriptor for the 'Defaults' configuration file */
} inotify;
#endif
/* definition for X Atoms */
struct {
/* Window-Manager related */
struct {
Atom state;
Atom change_state;
Atom protocols;
Atom take_focus;
Atom delete_window;
Atom save_yourself;
Atom client_leader;
Atom colormap_windows;
Atom colormap_notify;
Atom ignore_focus_events;
} wm;
/* GNUStep related */
struct {
Atom wm_attr;
Atom wm_miniaturize_window;
Atom wm_resizebar;
Atom titlebar_state;
} gnustep;
/* Destkop-environment related */
struct {
Atom gtk_object_path;
} desktop;
/* WindowMaker specific */
struct {
Atom menu;
Atom wm_protocols;
Atom state;
Atom wm_function;
Atom noticeboard;
Atom command;
Atom icon_size;
Atom icon_tile;
} wmaker;
} atom;
/* X Contexts */
struct {
XContext client_win;
XContext app_win;
XContext stack;
} context;
/* X Extensions */
struct {
#ifdef USE_XSHAPE
struct {
Bool supported;
int event_base;
} shape;
#endif
#ifdef KEEP_XKB_LOCK_STATUS
struct {
Bool supported;
int event_base;
} xkb;
#endif
#ifdef USE_RANDR
struct {
Bool supported;
int event_base;
} randr;
#endif
/*
* If no extension were activated, we would end up with an empty
* structure, which old compilers may not appreciate, so let's
* work around this with a simple:
*/
int dummy;
} xext;
/* Keyboard and shortcuts */
struct {
/*
* Bit-mask to hide special key modifiers which we don't want to
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
*/
unsigned int modifiers_mask;
} shortcut;
} w_global;
/****** Notifications ******/
extern const char WMNManaged[];
extern const char WMNUnmanaged[];
extern const char WMNChangedWorkspace[];
extern const char WMNChangedState[];
extern const char WMNChangedFocus[];
extern const char WMNChangedStacking[];
extern const char WMNChangedName[];
extern const char WMNWorkspaceCreated[];
extern const char WMNWorkspaceDestroyed[];
extern const char WMNWorkspaceChanged[];
extern const char WMNWorkspaceNameChanged[];
extern const char WMNResetStacking[];
#endif

View File

@@ -0,0 +1,11 @@
#ifndef WAPPEARANCE_SETTINGS_H_
#define WAPPEARANCE_SETTINGS_H_
/* appearance settings clientdata flags */
enum {
WFontSettings = 1 << 0,
WTextureSettings = 1 << 1,
WColorSettings = 1 << 2
};
#endif // WAPPEARANCE_SETTINGS_H_

28
bazel/wmaker/cursor.h Normal file
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
bazel/wmaker/geometry.h Normal file
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_

6
bazel/wmaker/globals.c Normal file
View File

@@ -0,0 +1,6 @@
#include "wmaker/globals.h"
#include "X11/Xlib.h"
Display *dpy;
struct wmaker_global_variables;

166
bazel/wmaker/globals.h Normal file
View File

@@ -0,0 +1,166 @@
#ifndef WGLOBALS_H_
#define WGLOBALS_H_
#include "X11/Xlib.h"
#include "X11/Xutil.h"
extern Display *dpy;
/* program states */
typedef enum {
WSTATE_NORMAL = 0,
WSTATE_NEED_EXIT = 1,
WSTATE_NEED_RESTART = 2,
WSTATE_EXITING = 3,
WSTATE_RESTARTING = 4,
WSTATE_MODAL = 5,
WSTATE_NEED_REREAD = 6
} wprog_state;
extern struct wmaker_global_variables {
/* Tracking of the state of the program */
struct {
wprog_state state;
wprog_state signal_state;
} program;
/* locale to use. NULL==POSIX or C */
const char *locale;
/* Tracking of X events timestamps */
struct {
/* ts of the last event we received */
Time last_event;
/* ts on the last time we did XSetInputFocus() */
Time focus_change;
} timestamp;
/* Global Domains, for storing dictionaries */
struct {
/* Note: you must #include <defaults.h> if you want to use them */
struct WDDomain *wmaker;
struct WDDomain *window_attr;
struct WDDomain *root_menu;
} domain;
/* Screens related */
int screen_count;
/*
* Ignore Workspace Change:
* this variable is used to prevent workspace switch while certain
* operations are ongoing.
*/
Bool ignore_workspace_change;
/*
* Process WorkspaceMap Event:
* this variable is set when the Workspace Map window is being displayed,
* it is mainly used to avoid re-opening another one at the same time
*/
Bool process_workspacemap_event;
#ifdef HAVE_INOTIFY
struct {
int fd_event_queue; /* Inotify's queue file descriptor */
int wd_defaults; /* Watch Descriptor for the 'Defaults' configuration file */
} inotify;
#endif
/* definition for X Atoms */
struct {
/* Window-Manager related */
struct {
Atom state;
Atom change_state;
Atom protocols;
Atom take_focus;
Atom delete_window;
Atom save_yourself;
Atom client_leader;
Atom colormap_windows;
Atom colormap_notify;
Atom ignore_focus_events;
} wm;
/* GNUStep related */
struct {
Atom wm_attr;
Atom wm_miniaturize_window;
Atom wm_resizebar;
Atom titlebar_state;
} gnustep;
/* Destkop-environment related */
struct {
Atom gtk_object_path;
} desktop;
/* WindowMaker specific */
struct {
Atom menu;
Atom wm_protocols;
Atom state;
Atom wm_function;
Atom noticeboard;
Atom command;
Atom icon_size;
Atom icon_tile;
} wmaker;
} atom;
/* X Contexts */
struct {
XContext client_win;
XContext app_win;
XContext stack;
} context;
/* X Extensions */
struct {
#ifdef USE_XSHAPE
struct {
Bool supported;
int event_base;
} shape;
#endif
#ifdef KEEP_XKB_LOCK_STATUS
struct {
Bool supported;
int event_base;
} xkb;
#endif
#ifdef USE_RANDR
struct {
Bool supported;
int event_base;
} randr;
#endif
/*
* If no extension were activated, we would end up with an empty
* structure, which old compilers may not appreciate, so let's
* work around this with a simple:
*/
int dummy;
} xext;
/* Keyboard and shortcuts */
struct {
/*
* Bit-mask to hide special key modifiers which we don't want to
* impact the shortcuts (typically: CapsLock, NumLock, ScrollLock)
*/
unsigned int modifiers_mask;
} shortcut;
} w_global;
#endif // WGLOBALS_H_

3
bazel/wmaker/keybind.c Normal file
View File

@@ -0,0 +1,3 @@
#include "wmaker/keybind.h"
WShortKey wKeyBindings[WKBD_LAST];

View File

@@ -19,8 +19,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WMKEYBIND_H
#define WMKEYBIND_H
#ifndef WKEYBIND_H
#define WKEYBIND_H
#include "X11/X.h"
/* <X11/X.h> doesn't define these, even though XFree supports them */
#ifndef Button6
@@ -174,8 +176,4 @@ typedef struct WShortKey {
extern WShortKey wKeyBindings[WKBD_LAST];
/* ---[ Functions ]------------------------------------------------------- */
void wKeyboardInitialize(void);
#endif /* WMKEYBIND_H */
#endif /* WKEYBIND_H */

View File

@@ -60,19 +60,12 @@
#include "WINGs/WUtil.h"
/****** Global Variables ******/
struct wmaker_global_variables w_global;
/* general info */
Display *dpy;
char *ProgName;
struct WPreferences wPreferences;
WShortKey wKeyBindings[WKBD_LAST];
/* notifications */
const char WMNManaged[] = "WMNManaged";
const char WMNUnmanaged[] = "WMNUnmanaged";

View File

@@ -0,0 +1,35 @@
#ifndef WNOTIFICATIONS_H_
#define WNOTIFICATIONS_H_
#ifdef MAINFILE
#define NOTIFICATION(n) const char WN##n [] = #n
#else
#define NOTIFICATION(n) extern const char WN##n []
#endif
NOTIFICATION(WindowAppearanceSettingsChanged);
NOTIFICATION(IconAppearanceSettingsChanged);
NOTIFICATION(IconTileSettingsChanged);
NOTIFICATION(MenuAppearanceSettingsChanged);
NOTIFICATION(MenuTitleAppearanceSettingsChanged);
extern const char WMNManaged[];
extern const char WMNUnmanaged[];
extern const char WMNChangedWorkspace[];
extern const char WMNChangedState[];
extern const char WMNChangedFocus[];
extern const char WMNChangedStacking[];
extern const char WMNChangedName[];
extern const char WMNWorkspaceCreated[];
extern const char WMNWorkspaceDestroyed[];
extern const char WMNWorkspaceChanged[];
extern const char WMNWorkspaceNameChanged[];
extern const char WMNResetStacking[];
#endif // WNOTIFICATIONS_H_

View File

@@ -0,0 +1,22 @@
package(default_visibility = ["//visibility:public"])
cc_library(
name = "interface",
hdrs = ["interface.h"],
deps = [
"//wmaker/screen:interface",
"//wrlib",
],
)
cc_library(
name = "pixmap",
hdrs = ["pixmap.h"],
srcs = ["pixmap.c"],
deps = [
":interface",
"//wmaker:globals",
"//wmaker/screen:interface",
"//wrlib",
],
)

View File

@@ -0,0 +1,18 @@
#ifndef WMPIXMAP_INTERFACE_H_
#define WMPIXMAP_INTERFACE_H_
#include "wrlib/wraster.h"
typedef struct WPixmap {
Pixmap image; /* icon image */
Pixmap mask; /* icon mask */
int width, height; /* size of pixmap */
int depth; /* depth of pixmap */
unsigned int shared:1; /* if pixmaps should be kept
* when structure is freed */
unsigned int client_owned:1;
unsigned int client_owned_mask:1;
} WPixmap;
#endif // WMPIXMAP_INTERFACE_H_

View File

@@ -18,17 +18,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "wconfig.h"
#include "wmaker/pixmap/pixmap.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "wmaker/globals.h"
#include "wmaker/pixmap/interface.h"
#include "wmaker/wconfig.h"
#include "wrlib/wraster.h"
#include "X11/Xlib.h"
#include "X11/Xutil.h"
#include <stdlib.h>
#include <string.h>
#include "WindowMaker.h"
#include "pixmap.h"
/*
*----------------------------------------------------------------------

View File

@@ -17,22 +17,12 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WMPIXMAP_H_
#define WMPIXMAP_H_
#include "screen.h"
typedef struct WPixmap {
Pixmap image; /* icon image */
Pixmap mask; /* icon mask */
int width, height; /* size of pixmap */
int depth; /* depth of pixmap */
unsigned int shared:1; /* if pixmaps should be kept
* when structure is freed */
unsigned int client_owned:1;
unsigned int client_owned_mask:1;
} WPixmap;
#ifndef WPIXMAP_PIXMAP_H_
#define WPIXMAP_PIXMAP_H_
#include "wmaker/pixmap/interface.h"
#include "wmaker/screen/interface.h"
#include "wrlib/wraster.h"
WPixmap *wPixmapCreate(Pixmap image, Pixmap mask);
@@ -43,4 +33,4 @@ WPixmap *wPixmapCreateFromXBMData(WScreen *scr, char *data, char *mask,
unsigned long bg);
void wPixmapDestroy(WPixmap *pix);
#endif
#endif // WPIXMAP_PIXMAP_H_

View File

@@ -0,0 +1,3 @@
#include "wmaker/preferences.h"
struct WPreferences wPreferences;

197
bazel/wmaker/preferences.h Normal file
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_

View File

@@ -19,21 +19,19 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "wconfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "wmaker/wconfig.h"
#include "wmaker/globals.h"
#include "wmaker/screen/interface.h"
#include "X11/Xlib.h"
#include "X11/Xutil.h"
#include "wrlib/wraster.h"
#include "WindowMaker.h"
#include "texture.h"
#include "resources.h"
#include "screen.h"
#include "WINGs/WUtil.h"
int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color)
{

View File

@@ -18,11 +18,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WMRESOURCES_H_
#define WMRESOURCES_H_
#ifndef WRESOURCES_H_
#define WRESOURCES_H_
int wGetColorForColormap(Colormap colormap, const char *color_name, XColor *color);
int wGetColor(WScreen *scr, const char *color_name, XColor *color);
void wFreeColor(WScreen *scr, unsigned long pixel);
#endif
#endif // WRESOURCES_H_

View File

@@ -0,0 +1,11 @@
package(default_visibility = ["//visibility:public"])
cc_library(
name = "interface",
hdrs = ["interface.h"],
deps = [
"//wmaker:geometry",
"//wmaker:wconfig",
"//WINGs",
],
)

View File

@@ -0,0 +1,353 @@
/*
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WMSCREEN_INTERFACE_H_
#define WMSCREEN_INTERFACE_H_
#include "wmaker/wconfig.h"
#include "wmaker/geometry.h"
#include <sys/types.h>
#include "X11/Xatom.h"
#include "WINGs/WINGs.h"
#include "WINGs/WUtil.h"
#define PRINT_SCREEN 1
#define PRINT_WINDOW 2
#define PRINT_PARTIAL 3
/* internal buttons */
#define WBUT_CLOSE 0
#define WBUT_BROKENCLOSE 1
#define WBUT_ICONIFY 2
#define WBUT_KILL 3
#ifdef XKB_BUTTON_HINT
#define WBUT_XKBGROUP1 4
#define WBUT_XKBGROUP2 5
#define WBUT_XKBGROUP3 6
#define WBUT_XKBGROUP4 7
#define PRED_BPIXMAPS 8 /* reserved for 4 groups */
#else
#define PRED_BPIXMAPS 4 /* count of WBUT icons */
#endif /* XKB_BUTTON_HINT */
typedef struct {
WMRect *screens;
int count; /* screen count, 0 = inactive */
int primary_head; /* main working screen */
} WXineramaInfo;
/* an area of the screen reserved by some window */
typedef struct WReservedArea {
WArea area;
Window window;
struct WReservedArea *next;
} WReservedArea;
typedef struct WAppIconChain {
struct WAppIcon *aicon;
struct WAppIconChain *next;
} WAppIconChain;
/* Drawers, which are docks, really */
typedef struct WDrawerChain {
struct WDock *adrawer;
struct WDrawerChain *next;
} WDrawerChain;
/*
* each WScreen is saved into a context associated with its root window
*/
typedef struct _WScreen {
int screen; /* screen number */
Window info_window; /* for our window manager info stuff */
#ifdef USE_ICCCM_WMREPLACE
Atom sn_atom; /* window manager selection */
#endif
int scr_width; /* size of the screen */
int scr_height;
Window root_win; /* root window of screen */
int depth; /* depth of the default visual */
Colormap colormap; /* root colormap */
int root_colormap_install_count;
struct WWindow *original_cmap_window; /* colormap before installing
* root colormap temporarily */
struct WWindow *cmap_window;
Colormap current_colormap;
Window w_win; /* window to use as drawable
* for new GCs, pixmaps etc. */
Visual *w_visual;
int w_depth;
Colormap w_colormap; /* our colormap */
WXineramaInfo xine_info;
Window no_focus_win; /* window to get focus when nobody
* else can do it */
struct WWindow *focused_window; /* window that has the focus
* Use this list if you want to
* traverse the entire window list
*/
struct WWindow *bfs_focused_window; /* window that had focus before
* another window entered fullscreen
*/
WMArray *selected_windows;
WMArray *fakeGroupLeaders; /* list of fake window group ids */
struct WAppIcon *app_icon_list; /* list of all app-icons on screen */
struct WApplication *wapp_list; /* list of all aplications */
WMBag *stacking_list; /* bag of lists of windows
* in stacking order.
* Indexed by window level
* and each list on the array
* is ordered from the topmost to
* the lowest window
*/
int window_count; /* number of windows in window_list */
int workspace_count; /* number of workspaces */
struct WWorkspace **workspaces; /* workspace array */
int current_workspace; /* current workspace number */
int last_workspace; /* last used workspace number */
WReservedArea *reservedAreas; /* used to build totalUsableArea */
WArea *usableArea; /* area of the workspace where
* we can put windows on, as defined
* by other clients (not us) */
WArea *totalUsableArea; /* same as above, but including
* the dock and other stuff */
WMColor *black;
WMColor *white;
WMColor *gray;
WMColor *darkGray;
/* shortcuts for the pixels of the above colors. just for convenience */
WMPixel black_pixel;
WMPixel white_pixel;
WMPixel light_pixel;
WMPixel dark_pixel;
Pixmap stipple_bitmap;
Pixmap transp_stipple; /* for making holes in icon masks for
* transparent icon simulation */
WMFont *title_font; /* default font for the titlebars */
WMFont *menu_title_font; /* font for menu titlebars */
WMFont *menu_entry_font; /* font for menu items */
WMFont *icon_title_font; /* for icon titles */
WMFont *clip_title_font; /* for clip titles */
WMFont *info_text_font; /* text on things like geometry
* hint boxes */
XFontStruct *tech_draw_font; /* font for tech draw style geom view
needs to be a core font so we can
use it with a XORing GC */
WMFont *workspace_name_font;
WMColor *select_color;
WMColor *select_text_color;
/* foreground colors */
WMColor *window_title_color[3]; /* window titlebar text (foc, unfoc, pfoc)*/
WMColor *menu_title_color[3]; /* menu titlebar text */
WMColor *clip_title_color[2]; /* clip title text */
WMColor *mtext_color; /* menu item text */
WMColor *dtext_color; /* disabled menu item text */
int frame_border_width;
WMColor *frame_border_color;
WMColor *frame_focused_border_color;
WMColor *frame_selected_border_color;
WMPixel line_pixel;
WMPixel frame_border_pixel; /* frame border */
WMPixel frame_focused_border_pixel; /* frame border */
WMPixel frame_selected_border_pixel;/* frame border */
union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -) */
union WTexture *window_title_texture[3]; /* win textures (foc, unfoc, pfoc) */
union WTexture *resizebar_texture[3];/* window resizebar texture (tex, -, -) */
union WTexture *menu_item_texture; /* menu item texture */
struct WTexSolid *menu_item_auxtexture; /* additional texture to draw menu
* cascade arrows */
struct WTexSolid *icon_title_texture;/* icon titles */
struct WTexSolid *widget_texture;
struct WTexSolid *icon_back_texture; /* icon back color for shadowing */
WMColor *icon_title_color; /* icon title color */
GC icon_select_gc;
GC frame_gc; /* gc for resize/move frame (root) */
GC line_gc; /* gc for drawing XORed lines (root) */
GC copy_gc; /* gc for XCopyArea() */
GC stipple_gc; /* gc for stippled filling */
GC draw_gc; /* gc for drawing misc things */
GC mono_gc; /* gc for 1 bit drawables */
struct WPixmap *b_pixmaps[PRED_BPIXMAPS]; /* internal pixmaps for buttons*/
struct WPixmap *menu_radio_indicator;/* left menu indicator */
struct WPixmap *menu_check_indicator;/* left menu indicator for checkmark */
struct WPixmap *menu_mini_indicator; /* for miniwindow */
struct WPixmap *menu_hide_indicator; /* for hidden window */
struct WPixmap *menu_shade_indicator; /* for shaded window */
struct WPixmap *menu_snap_vertical_indicator; /* for vertical snap window */
struct WPixmap *menu_snap_horizontal_indicator; /* for horizontal snap window */
struct WPixmap *menu_snap_rh_indicator; /* for righ half snap window */
struct WPixmap *menu_snap_lh_indicator; /* for left half snap window */
struct WPixmap *menu_snap_th_indicator; /* for top half snap window */
struct WPixmap *menu_snap_bh_indicator; /* for bottom half snap window */
struct WPixmap *menu_snap_tl_indicator; /* for top left snap window */
struct WPixmap *menu_snap_tr_indicator; /* for top rigt snap window */
struct WPixmap *menu_snap_bl_indicator; /* for bottom left snap window */
struct WPixmap *menu_snap_br_indicator; /* for bottom right snap window */
struct WPixmap *menu_snap_tiled_indicator; /* for tiled window */
struct WPixmap *menu_central_indicator; /* for central window */
int app_menu_x, app_menu_y; /* position for application menus */
struct WMenu *root_menu; /* root window menu */
struct WMenu *switch_menu; /* window list menu */
struct WMenu *workspace_menu; /* workspace operation */
struct WMenu *window_menu; /* window command menu */
struct WMenu *icon_menu; /* icon/appicon menu */
struct WMenu *workspace_submenu; /* workspace list for window_menu */
struct WDock *dock; /* the application dock */
struct WMenu *dock_pos_menu; /* Dock position menu */
struct WPixmap *dock_dots; /* 3 dots for the Dock */
Window dock_shadow; /* shadow for dock buttons */
struct WAppIcon *clip_icon; /* The clip main icon, or the dock's, if they are merged */
struct WMenu *clip_menu; /* Menu for clips */
struct WMenu *clip_submenu; /* Workspace list for clips */
struct WMenu *clip_options; /* Options for Clip */
struct WMenu *clip_ws_menu; /* workspace menu for clip */
struct WMenu *drawer_menu; /* Menu for drawers */
struct WDock *last_dock;
WAppIconChain *global_icons; /* for omnipresent icons chain in clip */
int global_icon_count; /* How many global icons do we have */
WDrawerChain *drawers; /* Chain of drawers */
/* Cache the following two informations, as they are used quite a lot */
int drawer_count; /* Nb of drawers that */
struct WDock *attracting_drawer; /* The drawer that auto-attracts icons, or NULL */
struct RContext *rcontext; /* wrlib context */
WMScreen *wmscreen; /* for widget library */
struct RImage *icon_tile;
struct RImage *clip_tile; /* tile with arrows to change workspace */
struct RImage *drawer_tile; /* tile for a drawer (tile + arrow) */
Pixmap icon_tile_pixmap; /* For app supplied icons */
struct RImage *def_icon_rimage; /* Default RImage icon */
struct WDialogData *dialog_data;
struct W_GeometryView *gview; /* size/position view */
/* state and other informations */
short cascade_index; /* for cascade window placement */
WMPropList *session_state;
/* for double-click detection */
Time last_click_time;
Window last_click_window;
int last_click_button;
/* balloon help data */
struct _WBalloon *balloon;
/* workspace name data */
Window workspace_name;
WMHandlerID *workspace_name_timer;
struct WorkspaceNameData *workspace_name_data;
/* mini screenshot data */
Window mini_screenshot;
time_t mini_screenshot_timeout;
WMHandlerID *mini_screenshot_timer;
/* for raise-delay */
WMHandlerID *autoRaiseTimer;
Window autoRaiseWindow; /* window that is scheduled to be
* raised */
/* for hot-corners delay */
WMHandlerID *hot_corner_timer;
/* for window shortcuts */
WMArray *shortcutWindows[MAX_WINDOW_SHORTCUTS];
#ifdef USE_DOCK_XDND
char *xdestring;
#endif
struct NetData *netdata;
int helper_fd;
pid_t helper_pid;
struct {
unsigned int startup:1; /* during window manager startup */
unsigned int regenerate_icon_textures:1;
unsigned int dnd_data_convertion_status:1;
unsigned int root_menu_changed_shortcuts:1;
unsigned int added_workspace_menu:1;
unsigned int added_windows_menu:1;
unsigned int startup2:1; /* startup phase 2 */
unsigned int next_click_is_not_double:1;
unsigned int backimage_helper_launched:1;
/* some client has issued a WM_COLORMAP_NOTIFY */
unsigned int colormap_stuff_blocked:1;
unsigned int doing_alt_tab:1;
unsigned int jump_back_pending:1;
unsigned int ignore_focus_events:1;
unsigned int in_hot_corner:3;
} flags;
} WScreen;
#endif // WMSCREEN_INTERFACE_H_

View File

@@ -1,5 +1,10 @@
cc_library(
name = "wrlib",
copts = [
"-DMAGICKCORE_HDRI_ENABLE=0",
"-DMAGICKCORE_QUANTUM_DEPTH=16",
"-DMAGICKCORE_CHANNEL_MASK_DEPTH=32",
],
srcs = [
"alpha_combine.c",
"color.c",