1706f2543Smrg#if !defined(WINPREFS_H) 2706f2543Smrg#define WINPREFS_H 3706f2543Smrg/* 4706f2543Smrg * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. 5706f2543Smrg * Copyright (C) Colin Harrison 2005-2008 6706f2543Smrg * 7706f2543Smrg * Permission is hereby granted, free of charge, to any person obtaining 8706f2543Smrg * a copy of this software and associated documentation files (the 9706f2543Smrg * "Software"), to deal in the Software without restriction, including 10706f2543Smrg * without limitation the rights to use, copy, modify, merge, publish, 11706f2543Smrg * distribute, sublicense, and/or sell copies of the Software, and to 12706f2543Smrg * permit persons to whom the Software is furnished to do so, subject to 13706f2543Smrg * the following conditions: 14706f2543Smrg * 15706f2543Smrg * The above copyright notice and this permission notice shall be 16706f2543Smrg * included in all copies or substantial portions of the Software. 17706f2543Smrg * 18706f2543Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19706f2543Smrg * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20706f2543Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21706f2543Smrg * NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR 22706f2543Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 23706f2543Smrg * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24706f2543Smrg * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25706f2543Smrg * 26706f2543Smrg * Except as contained in this notice, the name of the XFree86 Project 27706f2543Smrg * shall not be used in advertising or otherwise to promote the sale, use 28706f2543Smrg * or other dealings in this Software without prior written authorization 29706f2543Smrg * from the XFree86 Project. 30706f2543Smrg * 31706f2543Smrg * Authors: Earle F. Philhower, III 32706f2543Smrg * Colin Harrison 33706f2543Smrg */ 34706f2543Smrg 35706f2543Smrg/* Need Bool */ 36706f2543Smrg#include <X11/Xdefs.h> 37706f2543Smrg/* Need TRUE */ 38706f2543Smrg#include "misc.h" 39706f2543Smrg 40706f2543Smrg/* Need to know how long paths can be... */ 41706f2543Smrg#include <limits.h> 42706f2543Smrg/* Xwindows redefines PATH_MAX to at least 1024 */ 43706f2543Smrg#include <X11/Xwindows.h> 44706f2543Smrg 45706f2543Smrg#ifndef NAME_MAX 46706f2543Smrg#define NAME_MAX PATH_MAX 47706f2543Smrg#endif 48706f2543Smrg#define MENU_MAX 128 /* Maximum string length of a menu name or item */ 49706f2543Smrg#define PARAM_MAX (4*PATH_MAX) /* Maximum length of a parameter to a MENU */ 50706f2543Smrg 51706f2543Smrg 52706f2543Smrg/* Supported commands in a MENU {} statement */ 53706f2543Smrgtypedef enum MENUCOMMANDTYPE 54706f2543Smrg{ 55706f2543Smrg CMD_EXEC, /* /bin/sh -c the parameter */ 56706f2543Smrg CMD_MENU, /* Display a popup menu named param */ 57706f2543Smrg CMD_SEPARATOR, /* Menu separator */ 58706f2543Smrg CMD_ALWAYSONTOP, /* Toggle always-on-top mode */ 59706f2543Smrg CMD_RELOAD /* Reparse the .XWINRC file */ 60706f2543Smrg} MENUCOMMANDTYPE; 61706f2543Smrg 62706f2543Smrg#define STYLE_NONE (0L) /* Dummy the first entry */ 63706f2543Smrg#define STYLE_NOTITLE (1L) /* Force window style no titlebar */ 64706f2543Smrg#define STYLE_OUTLINE (1L<<1) /* Force window style just thin-line border */ 65706f2543Smrg#define STYLE_NOFRAME (1L<<2) /* Force window style no frame */ 66706f2543Smrg#define STYLE_TOPMOST (1L<<3) /* Open a window always-on-top */ 67706f2543Smrg#define STYLE_MAXIMIZE (1L<<4) /* Open a window maximized */ 68706f2543Smrg#define STYLE_MINIMIZE (1L<<5) /* Open a window minimized */ 69706f2543Smrg#define STYLE_BOTTOM (1L<<6) /* Open a window at the bottom of the Z order */ 70706f2543Smrg 71706f2543Smrg/* Where to place a system menu */ 72706f2543Smrgtypedef enum MENUPOSITION 73706f2543Smrg{ 74706f2543Smrg AT_START, /* Place menu at the top of the system menu */ 75706f2543Smrg AT_END /* Put it at the bottom of the menu (default) */ 76706f2543Smrg} MENUPOSITION; 77706f2543Smrg 78706f2543Smrg/* Menu item definitions */ 79706f2543Smrgtypedef struct MENUITEM 80706f2543Smrg{ 81706f2543Smrg char text[MENU_MAX+1]; /* To be displayed in menu */ 82706f2543Smrg MENUCOMMANDTYPE cmd; /* What should it do? */ 83706f2543Smrg char param[PARAM_MAX+1]; /* Any parameters? */ 84706f2543Smrg unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */ 85706f2543Smrg} MENUITEM; 86706f2543Smrg 87706f2543Smrg/* A completely read in menu... */ 88706f2543Smrgtypedef struct MENUPARSED 89706f2543Smrg{ 90706f2543Smrg char menuName[MENU_MAX+1]; /* What's it called in the text? */ 91706f2543Smrg MENUITEM *menuItem; /* Array of items */ 92706f2543Smrg int menuItems; /* How big's the array? */ 93706f2543Smrg} MENUPARSED; 94706f2543Smrg 95706f2543Smrg/* To map between a window and a system menu to add for it */ 96706f2543Smrgtypedef struct SYSMENUITEM 97706f2543Smrg{ 98706f2543Smrg char match[MENU_MAX+1]; /* String to look for to apply this sysmenu */ 99706f2543Smrg char menuName[MENU_MAX+1]; /* Which menu to show? Used to set *menu */ 100706f2543Smrg MENUPOSITION menuPos; /* Where to place it (ignored in root) */ 101706f2543Smrg} SYSMENUITEM; 102706f2543Smrg 103706f2543Smrg/* To redefine icons for certain window types */ 104706f2543Smrgtypedef struct ICONITEM 105706f2543Smrg{ 106706f2543Smrg char match[MENU_MAX+1]; /* What string to search for? */ 107706f2543Smrg char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */ 108706f2543Smrg HICON hicon; /* LoadImage() result */ 109706f2543Smrg} ICONITEM; 110706f2543Smrg 111706f2543Smrg/* To redefine styles for certain window types */ 112706f2543Smrgtypedef struct STYLEITEM 113706f2543Smrg{ 114706f2543Smrg char match[MENU_MAX+1]; /* What string to search for? */ 115706f2543Smrg unsigned long type; /* What should it do? */ 116706f2543Smrg} STYLEITEM; 117706f2543Smrg 118706f2543Smrgtypedef struct WINPREFS 119706f2543Smrg{ 120706f2543Smrg /* Menu information */ 121706f2543Smrg MENUPARSED *menu; /* Array of created menus */ 122706f2543Smrg int menuItems; /* How big? */ 123706f2543Smrg 124706f2543Smrg /* Taskbar menu settings */ 125706f2543Smrg char rootMenuName[MENU_MAX+1]; /* Menu for taskbar icon */ 126706f2543Smrg 127706f2543Smrg /* System menu addition menus */ 128706f2543Smrg SYSMENUITEM *sysMenu; 129706f2543Smrg int sysMenuItems; 130706f2543Smrg 131706f2543Smrg /* Which menu to add to unmatched windows? */ 132706f2543Smrg char defaultSysMenuName[MENU_MAX+1]; 133706f2543Smrg MENUPOSITION defaultSysMenuPos; /* Where to place it */ 134706f2543Smrg 135706f2543Smrg /* Icon information */ 136706f2543Smrg char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */ 137706f2543Smrg char defaultIconName[NAME_MAX+1]; /* Replacement for x.ico */ 138706f2543Smrg char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */ 139706f2543Smrg 140706f2543Smrg ICONITEM *icon; 141706f2543Smrg int iconItems; 142706f2543Smrg 143706f2543Smrg STYLEITEM *style; 144706f2543Smrg int styleItems; 145706f2543Smrg 146706f2543Smrg /* Force exit flag */ 147706f2543Smrg Bool fForceExit; 148706f2543Smrg 149706f2543Smrg /* Silent exit flag */ 150706f2543Smrg Bool fSilentExit; 151706f2543Smrg 152706f2543Smrg} WINPREFS; 153706f2543Smrg 154706f2543Smrg/* The global pref settings structure loaded by the winprefyacc.y parser */ 155706f2543Smrgextern WINPREFS pref; 156706f2543Smrg 157706f2543Smrg 158706f2543Smrg/* Functions */ 159706f2543Smrgvoid 160706f2543SmrgLoadPreferences(void); 161706f2543Smrg 162706f2543Smrgvoid 163706f2543SmrgSetupRootMenu (unsigned long hmenuRoot); 164706f2543Smrg 165706f2543Smrgvoid 166706f2543SmrgSetupSysMenu (unsigned long hwndIn); 167706f2543Smrg 168706f2543Smrgvoid 169706f2543SmrgHandleCustomWM_INITMENU(unsigned long hwndIn, 170706f2543Smrg unsigned long hmenuIn); 171706f2543Smrg 172706f2543SmrgBool 173706f2543SmrgHandleCustomWM_COMMAND (unsigned long hwndIn, 174706f2543Smrg int command); 175706f2543Smrg 176706f2543Smrgint 177706f2543SmrgwinIconIsOverride (unsigned hiconIn); 178706f2543Smrg 179706f2543SmrgHICON 180706f2543SmrgwinOverrideIcon (unsigned long longpWin); 181706f2543Smrg 182706f2543Smrgunsigned long 183706f2543SmrgwinOverrideStyle (unsigned long longpWin); 184706f2543Smrg 185706f2543SmrgHICON 186706f2543SmrgwinTaskbarIcon(void); 187706f2543Smrg 188706f2543SmrgHICON 189706f2543SmrgwinOverrideDefaultIcon(int size); 190706f2543Smrg#endif 191