1 #if !defined(WINPREFS_H)
4 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
5 * Copyright (C) Colin Harrison 2005-2008
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 * Except as contained in this notice, the name of the XFree86 Project
27 * shall not be used in advertising or otherwise to promote the sale, use
28 * or other dealings in this Software without prior written authorization
29 * from the XFree86 Project.
31 * Authors: Earle F. Philhower, III
36 #include <X11/Xdefs.h>
40 /* Need to know how long paths can be... */
42 /* Xwindows redefines PATH_MAX to at least 1024 */
43 #include <X11/Xwindows.h>
46 #define NAME_MAX PATH_MAX
48 #define MENU_MAX 128 /* Maximum string length of a menu name or item */
49 #define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
51 /* Supported commands in a MENU {} statement */
52 typedef enum MENUCOMMANDTYPE
{
53 CMD_EXEC
, /* /bin/sh -c the parameter */
54 CMD_MENU
, /* Display a popup menu named param */
55 CMD_SEPARATOR
, /* Menu separator */
56 CMD_ALWAYSONTOP
, /* Toggle always-on-top mode */
57 CMD_RELOAD
/* Reparse the .XWINRC file */
60 #define STYLE_NONE (0L) /* Dummy the first entry */
61 #define STYLE_NOTITLE (1L) /* Force window style no titlebar */
62 #define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */
63 #define STYLE_NOFRAME (1L<<2) /* Force window style no frame */
64 #define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */
65 #define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */
66 #define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */
67 #define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */
69 /* Where to place a system menu */
70 typedef enum MENUPOSITION
{
71 AT_START
, /* Place menu at the top of the system menu */
72 AT_END
/* Put it at the bottom of the menu (default) */
75 /* Menu item definitions */
76 typedef struct MENUITEM
{
77 char text
[MENU_MAX
+ 1]; /* To be displayed in menu */
78 MENUCOMMANDTYPE cmd
; /* What should it do? */
79 char param
[PARAM_MAX
+ 1]; /* Any parameters? */
80 unsigned long commandID
; /* Windows WM_COMMAND ID assigned at runtime */
83 /* A completely read in menu... */
84 typedef struct MENUPARSED
{
85 char menuName
[MENU_MAX
+ 1]; /* What's it called in the text? */
86 MENUITEM
*menuItem
; /* Array of items */
87 int menuItems
; /* How big's the array? */
90 /* To map between a window and a system menu to add for it */
91 typedef struct SYSMENUITEM
{
92 char match
[MENU_MAX
+ 1]; /* String to look for to apply this sysmenu */
93 char menuName
[MENU_MAX
+ 1]; /* Which menu to show? Used to set *menu */
94 MENUPOSITION menuPos
; /* Where to place it (ignored in root) */
97 /* To redefine icons for certain window types */
98 typedef struct ICONITEM
{
99 char match
[MENU_MAX
+ 1]; /* What string to search for? */
100 char iconFile
[PATH_MAX
+ NAME_MAX
+ 2]; /* Icon location, WIN32 path */
101 HICON hicon
; /* LoadImage() result */
104 /* To redefine styles for certain window types */
105 typedef struct STYLEITEM
{
106 char match
[MENU_MAX
+ 1]; /* What string to search for? */
107 unsigned long type
; /* What should it do? */
110 typedef struct WINPREFS
{
111 /* Menu information */
112 MENUPARSED
*menu
; /* Array of created menus */
113 int menuItems
; /* How big? */
115 /* Taskbar menu settings */
116 char rootMenuName
[MENU_MAX
+ 1]; /* Menu for taskbar icon */
118 /* System menu addition menus */
119 SYSMENUITEM
*sysMenu
;
122 /* Which menu to add to unmatched windows? */
123 char defaultSysMenuName
[MENU_MAX
+ 1];
124 MENUPOSITION defaultSysMenuPos
; /* Where to place it */
126 /* Icon information */
127 char iconDirectory
[PATH_MAX
+ 1]; /* Where do the .icos lie? (Win32 path) */
128 char defaultIconName
[NAME_MAX
+ 1]; /* Replacement for x.ico */
129 char trayIconName
[NAME_MAX
+ 1]; /* Replacement for tray icon */
137 /* Force exit flag */
140 /* Silent exit flag */
145 /* The global pref settings structure loaded by the winprefyacc.y parser */
146 extern WINPREFS pref
;
150 LoadPreferences(void);
153 SetupRootMenu(HMENU root
);
156 SetupSysMenu(HWND hwnd
);
159 HandleCustomWM_INITMENU(HWND hwnd
, HMENU hmenu
);
162 HandleCustomWM_COMMAND(HWND hwnd
, int command
);
165 winIconIsOverride(HICON hicon
);
167 HICON
winOverrideIcon(char *res_name
, char *res_class
, char *wmName
);
170 winOverrideStyle(char *res_name
, char *res_class
, char *wmName
);
172 HICON
winTaskbarIcon(void);
174 HICON
winOverrideDefaultIcon(int size
);