fix overflow bug, try2
[wmaker-crm.git] / wmlib / WMaker.h
blob441e49495fd31772a59811e007c8325bf5d30633
1 /*
2 * WindowMaker interface definitions
3 *
4 * Copyright (C) 1997-2002 Alfredo K. Kojima
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef _WMLIB_H_
22 #define _WMLIB_H_
24 /* the definitions in this file can change at any time. WINGs has more
25 * stable definitions */
27 #include <X11/Xlib.h>
28 #include <X11/Xmd.h>
30 #ifdef __cplusplus
31 extern "C" {
32 #endif /* __cplusplus */
34 typedef struct {
35 CARD32 flags;
36 CARD32 window_style;
37 CARD32 window_level;
38 CARD32 reserved;
39 Pixmap miniaturize_pixmap; /* pixmap for miniaturize button */
40 Pixmap close_pixmap; /* pixmap for close button */
41 Pixmap miniaturize_mask; /* miniaturize pixmap mask */
42 Pixmap close_mask; /* close pixmap mask */
43 CARD32 extra_flags;
44 } GNUstepWMAttributes;
46 #define GSWindowStyleAttr (1<<0)
47 #define GSWindowLevelAttr (1<<1)
48 #define GSMiniaturizePixmapAttr (1<<3)
49 #define GSClosePixmapAttr (1<<4)
50 #define GSMiniaturizeMaskAttr (1<<5)
51 #define GSCloseMaskAttr (1<<6)
52 #define GSExtraFlagsAttr (1<<7)
56 #define GSClientResizeFlag (1<<0)
57 #define GSFullKeyboardEventsFlag (1<<1)
58 #define GSMenuWindowFlag (1<<2)
59 #define GSIconWindowFlag (1<<3)
60 #define GSSkipWindowListFlag (1<<4)
61 #define GSNoApplicationIconFlag (1<<5)
62 #define GSDarkGrayTitlebarFlag (1<<8)
65 #define WMFHideOtherApplications 10
66 #define WMFHideApplication 12
69 #ifndef _DEFINED_GNUSTEP_WINDOW_INFO
70 #define _DEFINED_GNUSTEP_WINDOW_INFO
72 * Window levels are taken from GNUstep (gui/AppKit/NSWindow.h)
73 * NSDesktopWindowLevel intended to be the level at which things
74 * on the desktop sit ... so you should be able
75 * to put a desktop background just below it.
77 * Applications are actually permitted to use any value in the
78 * range INT_MIN+1 to INT_MAX
80 enum {
81 WMDesktopWindowLevel = -1000, /* GNUstep addition */
82 WMNormalWindowLevel = 0,
83 WMFloatingWindowLevel = 3,
84 WMSubmenuWindowLevel = 3,
85 WMTornOffMenuWindowLevel = 3,
86 WMMainMenuWindowLevel = 20,
87 WMDockWindowLevel = 21, /* Deprecated - use NSStatusWindowLevel */
88 WMStatusWindowLevel = 21,
89 WMModalPanelWindowLevel = 100,
90 WMPopUpMenuWindowLevel = 101,
91 WMScreenSaverWindowLevel = 1000
95 /* window attributes */
96 enum {
97 WMBorderlessWindowMask = 0,
98 WMTitledWindowMask = 1,
99 WMClosableWindowMask = 2,
100 WMMiniaturizableWindowMask = 4,
101 WMResizableWindowMask = 8,
102 WMIconWindowMask = 64,
103 WMMiniWindowMask = 128
105 #endif
107 typedef struct _wmAppContext WMAppContext;
109 typedef struct _wmMenu WMMenu;
111 typedef void (*WMMenuAction)(void *clientdata, int code, Time timestamp);
113 typedef void (*WMFreeFunction)(void *clientdata);
115 int WMProcessEvent(WMAppContext *app, XEvent *event);
118 WMAppContext *WMAppCreateWithMain(Display *display, int screen_number,
119 Window main_window);
121 WMAppContext *WMAppCreate(Display *display, int screen_number);
123 int WMAppAddWindow(WMAppContext *app, Window window);
125 int WMAppSetMainMenu(WMAppContext *app, WMMenu *menu);
128 int WMRealizeMenus(WMAppContext *app);
131 void WMSetWindowAttributes(Display *dpy, Window window,
132 GNUstepWMAttributes *attributes);
135 void WMHideApplication(WMAppContext *app);
136 void WMHideOthers(WMAppContext *app);
139 * WARNING: the menu related functions might be removed in the future.
141 WMMenu *WMMenuCreate(WMAppContext *app, char *title);
143 int WMMenuAddItem(WMMenu *menu, char *text, WMMenuAction action,
144 void *clientData, WMFreeFunction freedata, char *rtext);
146 int WMMenuInsertItem(WMMenu *menu, int index, char *text,
147 WMMenuAction *action, char *rtext);
149 int WMMenuRemoveItem(WMMenu *menu, int index);
151 int WMMenuAddSubmenu(WMMenu *menu, char *title, WMMenu *submenu);
153 void WMMenuSetEnabled(WMMenu *menu, int index, int enabled);
155 void WMMenuDestroy(WMMenu *menu, int submenus);
157 #ifdef __cplusplus
159 #endif /* __cplusplus */
161 #endif