First import
[xorg_rtime.git] / xorg-server-1.4 / hw / xwin / winprefs.h
blobd9e09deea99d5d8baf7b71bfd474964f12717f4c
1 #if !defined(WINPREFS_H)
2 #define WINPREFS_H
3 /*
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
33 /* Need Bool */
34 #include <X11/Xdefs.h>
35 /* Need TRUE */
36 #include "misc.h"
38 /* Need to know how long paths can be... */
39 #include <limits.h>
40 /* Xwindows redefines PATH_MAX to at least 1024 */
41 #include <X11/Xwindows.h>
43 #ifndef NAME_MAX
44 #define NAME_MAX PATH_MAX
45 #endif
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 */
58 } MENUCOMMANDTYPE;
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) */
65 } MENUPOSITION;
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 */
74 } MENUITEM;
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? */
82 } MENUPARSED;
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) */
90 } SYSMENUITEM;
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 */
98 } ICONITEM;
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;
111 int sysMenuItems;
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 */
122 ICONITEM *icon;
123 int iconItems;
125 /* Silent exit flag */
126 Bool fSilentExit;
128 } WINPREFS;
133 /* Functions */
134 void
135 LoadPreferences(void);
137 void
138 SetupRootMenu (unsigned long hmenuRoot);
140 void
141 SetupSysMenu (unsigned long hwndIn);
143 void
144 HandleCustomWM_INITMENU(unsigned long hwndIn,
145 unsigned long hmenuIn);
147 Bool
148 HandleCustomWM_COMMAND (unsigned long hwndIn,
149 int command);
152 winIconIsOverride (unsigned hiconIn);
154 unsigned long
155 winOverrideIcon (unsigned long longpWin);
157 unsigned long
158 winTaskbarIcon(void);
160 unsigned long
161 winOverrideDefaultIcon(int size);
162 #endif