1 #if !defined(WINPREFS_H)
4 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
22 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 * Except as contained in this notice, the name of the XFree86 Project
26 * shall not be used in advertising or otherwise to promote the sale, use
27 * or other dealings in this Software without prior written authorization
28 * from the XFree86 Project.
30 * Authors: Earle F. Philhower, III
34 #include <X11/Xdefs.h>
38 /* Need to know how long paths can be... */
40 /* Xwindows redefines PATH_MAX to at least 1024 */
41 #include <X11/Xwindows.h>
44 #define NAME_MAX PATH_MAX
46 #define MENU_MAX 128 /* Maximum string length of a menu name or item */
47 #define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */
50 /* Supported commands in a MENU {} statement */
51 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 /* Where to place a system menu */
61 typedef enum MENUPOSITION
63 AT_START
, /* Place menu at the top of the system menu */
64 AT_END
/* Put it at the bottom of the menu (default) */
67 /* Menu item definitions */
68 typedef struct MENUITEM
70 char text
[MENU_MAX
+1]; /* To be displayed in menu */
71 MENUCOMMANDTYPE cmd
; /* What should it do? */
72 char param
[PARAM_MAX
+1]; /* Any parameters? */
73 unsigned long commandID
; /* Windows WM_COMMAND ID assigned at runtime */
76 /* A completely read in menu... */
77 typedef struct MENUPARSED
79 char menuName
[MENU_MAX
+1]; /* What's it called in the text? */
80 MENUITEM
*menuItem
; /* Array of items */
81 int menuItems
; /* How big's the array? */
84 /* To map between a window and a system menu to add for it */
85 typedef struct SYSMENUITEM
87 char match
[MENU_MAX
+1]; /* String to look for to apply this sysmenu */
88 char menuName
[MENU_MAX
+1]; /* Which menu to show? Used to set *menu */
89 MENUPOSITION menuPos
; /* Where to place it (ignored in root) */
92 /* To redefine icons for certain window types */
93 typedef struct ICONITEM
95 char match
[MENU_MAX
+1]; /* What string to search for? */
96 char iconFile
[PATH_MAX
+NAME_MAX
+2]; /* Icon location, WIN32 path */
97 unsigned long hicon
; /* LoadImage() result */
100 typedef struct WINPREFS
102 /* Menu information */
103 MENUPARSED
*menu
; /* Array of created menus */
104 int menuItems
; /* How big? */
106 /* Taskbar menu settings */
107 char rootMenuName
[MENU_MAX
+1]; /* Menu for taskbar icon */
109 /* System menu addition menus */
110 SYSMENUITEM
*sysMenu
;
113 /* Which menu to add to unmatched windows? */
114 char defaultSysMenuName
[MENU_MAX
+1];
115 MENUPOSITION defaultSysMenuPos
; /* Where to place it */
117 /* Icon information */
118 char iconDirectory
[PATH_MAX
+1]; /* Where do the .icos lie? (Win32 path) */
119 char defaultIconName
[NAME_MAX
+1]; /* Replacement for x.ico */
120 char trayIconName
[NAME_MAX
+1]; /* Replacement for tray icon */
125 /* Silent exit flag */
135 LoadPreferences(void);
138 SetupRootMenu (unsigned long hmenuRoot
);
141 SetupSysMenu (unsigned long hwndIn
);
144 HandleCustomWM_INITMENU(unsigned long hwndIn
,
145 unsigned long hmenuIn
);
148 HandleCustomWM_COMMAND (unsigned long hwndIn
,
152 winIconIsOverride (unsigned hiconIn
);
155 winOverrideIcon (unsigned long longpWin
);
158 winTaskbarIcon(void);
161 winOverrideDefaultIcon(int size
);