Files
wmaker/bazel/wmaker/WindowMaker.h
T

288 lines
7.2 KiB
C

/*
* Window Maker window manager
*
* Copyright (c) 1997-2003 Alfredo K. Kojima
* Copyright (c) 2014-2023 Window Maker Team
*
* 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 WINDOWMAKER_H_
#define WINDOWMAKER_H_
#include "wconfig.h"
#include <assert.h>
#include <limits.h>
#include "WINGs/WINGs.h"
/* class codes */
typedef enum {
WCLASS_UNKNOWN = 0,
WCLASS_WINDOW = 1, /* managed client windows */
WCLASS_MENU = 2, /* root menus */
WCLASS_APPICON = 3,
WCLASS_DUMMYWINDOW = 4, /* window that holds window group leader */
WCLASS_MINIWINDOW = 5,
WCLASS_DOCK_ICON = 6,
WCLASS_PAGER = 7,
WCLASS_TEXT_INPUT = 8,
WCLASS_FRAME = 9
} WClassType;
/*
* generic window levels (a superset of the N*XTSTEP ones)
* Applications should use levels between WMDesktopLevel and
* WMScreensaverLevel anything boyond that range is allowed,
* but discouraged.
*/
enum {
WMBackLevel = INT_MIN+1, /* Very lowest level */
WMDesktopLevel = -1000, /* Lowest level of normal use */
WMSunkenLevel = -1,
WMNormalLevel = 0,
WMFloatingLevel = 3,
WMDockLevel = 5,
WMSubmenuLevel = 15,
WMMainMenuLevel = 20,
WMStatusLevel = 21,
WMFullscreenLevel = 50,
WMModalLevel = 100,
WMPopUpLevel = 101,
WMScreensaverLevel = 1000,
WMOuterSpaceLevel = INT_MAX
};
/*
* WObjDescriptor will be used by the event dispatcher to
* send events to a particular object through the methods in the
* method table. If all objects of the same class share the
* same methods, the class method table should be used, otherwise
* a new method table must be created for each object.
* It is also assigned to find the parent structure of a given
* window (like the WWindow or WMenu for a button)
*/
typedef struct WObjDescriptor {
void *self; /* the object that will be called */
/* event handlers */
void (*handle_expose)(struct WObjDescriptor *sender, XEvent *event);
void (*handle_mousedown)(struct WObjDescriptor *sender, XEvent *event);
void (*handle_enternotify)(struct WObjDescriptor *sender, XEvent *event);
void (*handle_leavenotify)(struct WObjDescriptor *sender, XEvent *event);
WClassType parent_type; /* type code of the parent */
void *parent; /* parent object (WWindow or WMenu) */
} WObjDescriptor;
/* geometry displays */
#define WDIS_NEW 0 /* new style */
#define WDIS_CENTER 1 /* center of screen */
#define WDIS_TOPLEFT 2 /* top left corner of screen */
#define WDIS_FRAME_CENTER 3 /* center of the frame */
#define WDIS_NONE 4
/* keyboard input focus mode */
#define WKF_CLICK 0
#define WKF_SLOPPY 2
/* colormap change mode */
#define WCM_CLICK 0
#define WCM_POINTER 1
/* window placement mode */
#define WPM_MANUAL 0
#define WPM_CASCADE 1
#define WPM_SMART 2
#define WPM_RANDOM 3
#define WPM_AUTO 4
#define WPM_CENTER 5
/* text justification */
#define WTJ_CENTER 0
#define WTJ_LEFT 1
#define WTJ_RIGHT 2
/* iconification styles */
#define WIS_ZOOM 0
#define WIS_TWIST 1
#define WIS_FLIP 2
#define WIS_NONE 3
#define WIS_RANDOM 4 /* secret */
/* switchmenu actions */
#define ACTION_ADD 0
#define ACTION_REMOVE 1
#define ACTION_CHANGE 2
#define ACTION_CHANGE_WORKSPACE 3
#define ACTION_CHANGE_STATE 4
/* speeds */
#define SPEED_ULTRAFAST 0
#define SPEED_FAST 1
#define SPEED_MEDIUM 2
#define SPEED_SLOW 3
#define SPEED_ULTRASLOW 4
/* window states */
#define WS_FOCUSED 0
#define WS_UNFOCUSED 1
#define WS_PFOCUSED 2
/* clip title colors */
#define CLIP_NORMAL 0
#define CLIP_COLLAPSED 1
/* icon yard position */
#define IY_VERT 1
#define IY_HORIZ 0
#define IY_TOP 2
#define IY_BOTTOM 0
#define IY_RIGHT 4
#define IY_LEFT 0
/* menu styles */
#define MS_NORMAL 0
#define MS_SINGLE_TEXTURE 1
#define MS_FLAT 2
/* workspace actions */
#define WA_NONE 0
#define WA_SELECT_WINDOWS 1
#define WA_OPEN_APPMENU 2
#define WA_OPEN_WINLISTMENU 3
#define WA_SWITCH_WORKSPACES 4
#define WA_MOVE_PREVWORKSPACE 5
#define WA_MOVE_NEXTWORKSPACE 6
#define WA_SWITCH_WINDOWS 7
#define WA_MOVE_PREVWINDOW 8
#define WA_MOVE_NEXTWINDOW 9
/* workspace display position */
#define WD_NONE 0
#define WD_CENTER 1
#define WD_TOP 2
#define WD_BOTTOM 3
#define WD_TOPLEFT 4
#define WD_TOPRIGHT 5
#define WD_BOTTOMLEFT 6
#define WD_BOTTOMRIGHT 7
/* titlebar style */
#define TS_NEW 0
#define TS_OLD 1
#define TS_NEXT 2
/* workspace border position */
#define WB_NONE 0
#define WB_LEFTRIGHT 1
#define WB_TOPBOTTOM 2
#define WB_ALLDIRS (WB_LEFTRIGHT|WB_TOPBOTTOM)
/* drag maximized window behaviors */
enum {
DRAGMAX_MOVE,
DRAGMAX_RESTORE,
DRAGMAX_UNMAXIMIZE,
DRAGMAX_NOMOVE
};
/* 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;
#define WCHECK_STATE(chk_state) (w_global.program.state == (chk_state))
#define WCHANGE_STATE(nstate) {\
if (w_global.program.state == WSTATE_NORMAL \
|| (nstate) != WSTATE_MODAL) \
w_global.program.state = (nstate); \
if (w_global.program.signal_state != 0) \
w_global.program.state = w_global.program.signal_state; \
}
/* only call inside signal handlers, with signals blocked */
#define SIG_WCHANGE_STATE(nstate) {\
w_global.program.signal_state = (nstate); \
w_global.program.state = (nstate); \
}
/* Flags for the Window Maker state when restarting/crash situations */
#define WFLAGS_NONE (0)
#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
};
/****** Global Variables ******/
/****** 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