~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to hw/xwin/winprefs.h

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#if !defined(WINPREFS_H)
 
2
#define WINPREFS_H
 
3
/*
 
4
 * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
 
5
 *
 
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:
 
13
 *
 
14
 * The above copyright notice and this permission notice shall be
 
15
 * included in all copies or substantial portions of the Software.
 
16
 *
 
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.
 
24
 *
 
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.
 
29
 *
 
30
 * Authors:     Earle F. Philhower, III
 
31
 */
 
32
/* $XFree86: $ */
 
33
 
 
34
/* Need Bool */
 
35
#include <X11/Xdefs.h>
 
36
/* Need TRUE */
 
37
#include "misc.h"
 
38
 
 
39
/* Need to know how long paths can be... */
 
40
#include <limits.h>
 
41
/* Xwindows redefines PATH_MAX to at least 1024 */
 
42
#include <X11/Xwindows.h>
 
43
 
 
44
#ifndef NAME_MAX
 
45
#define NAME_MAX PATH_MAX
 
46
#endif
 
47
#define MENU_MAX 128   /* Maximum string length of a menu name or item */
 
48
#define PARAM_MAX (4*PATH_MAX)  /* Maximum length of a parameter to a MENU */
 
49
 
 
50
 
 
51
/* Supported commands in a MENU {} statement */
 
52
typedef enum MENUCOMMANDTYPE
 
53
{
 
54
  CMD_EXEC,         /* /bin/sh -c the parameter            */
 
55
  CMD_MENU,         /* Display a popup menu named param    */
 
56
  CMD_SEPARATOR,    /* Menu separator                      */
 
57
  CMD_ALWAYSONTOP,  /* Toggle always-on-top mode           */
 
58
  CMD_RELOAD        /* Reparse the .XWINRC file            */
 
59
} MENUCOMMANDTYPE;
 
60
 
 
61
/* Where to place a system menu */
 
62
typedef enum MENUPOSITION
 
63
{
 
64
  AT_START,   /* Place menu at the top of the system menu   */
 
65
  AT_END      /* Put it at the bottom of the menu (default) */
 
66
} MENUPOSITION;
 
67
 
 
68
/* Menu item definitions */
 
69
typedef struct MENUITEM
 
70
{
 
71
  char text[MENU_MAX+1];   /* To be displayed in menu */
 
72
  MENUCOMMANDTYPE cmd;     /* What should it do? */
 
73
  char param[PARAM_MAX+1]; /* Any parameters? */
 
74
  unsigned long commandID; /* Windows WM_COMMAND ID assigned at runtime */
 
75
} MENUITEM;
 
76
 
 
77
/* A completely read in menu... */
 
78
typedef struct MENUPARSED
 
79
{
 
80
  char menuName[MENU_MAX+1]; /* What's it called in the text? */
 
81
  MENUITEM *menuItem;        /* Array of items */
 
82
  int menuItems;             /* How big's the array? */
 
83
} MENUPARSED;
 
84
 
 
85
/* To map between a window and a system menu to add for it */
 
86
typedef struct SYSMENUITEM
 
87
{
 
88
  char match[MENU_MAX+1];    /* String to look for to apply this sysmenu */
 
89
  char menuName[MENU_MAX+1]; /* Which menu to show? Used to set *menu */
 
90
  MENUPOSITION menuPos;      /* Where to place it (ignored in root) */
 
91
} SYSMENUITEM;
 
92
 
 
93
/* To redefine icons for certain window types */
 
94
typedef struct ICONITEM
 
95
{
 
96
  char match[MENU_MAX+1];             /* What string to search for? */
 
97
  char iconFile[PATH_MAX+NAME_MAX+2]; /* Icon location, WIN32 path */
 
98
  unsigned long hicon;                /* LoadImage() result */
 
99
} ICONITEM;
 
100
 
 
101
typedef struct WINPREFS
 
102
{
 
103
  /* Menu information */
 
104
  MENUPARSED *menu; /* Array of created menus */
 
105
  int menuItems;      /* How big? */
 
106
 
 
107
  /* Taskbar menu settings */
 
108
  char rootMenuName[MENU_MAX+1];  /* Menu for taskbar icon */
 
109
 
 
110
  /* System menu addition menus */
 
111
  SYSMENUITEM *sysMenu;
 
112
  int sysMenuItems;
 
113
 
 
114
  /* Which menu to add to unmatched windows? */
 
115
  char defaultSysMenuName[MENU_MAX+1];
 
116
  MENUPOSITION defaultSysMenuPos;   /* Where to place it */
 
117
 
 
118
  /* Icon information */
 
119
  char iconDirectory[PATH_MAX+1]; /* Where do the .icos lie? (Win32 path) */
 
120
  char defaultIconName[NAME_MAX+1];   /* Replacement for x.ico */
 
121
  char trayIconName[NAME_MAX+1]; /* Replacement for tray icon */
 
122
 
 
123
  ICONITEM *icon;
 
124
  int iconItems;
 
125
 
 
126
  /* Silent exit flag */
 
127
  Bool fSilentExit;
 
128
 
 
129
} WINPREFS;
 
130
 
 
131
 
 
132
 
 
133
 
 
134
/* Functions */
 
135
void
 
136
LoadPreferences(void);
 
137
 
 
138
void
 
139
SetupRootMenu (unsigned long hmenuRoot);
 
140
 
 
141
void
 
142
SetupSysMenu (unsigned long hwndIn);
 
143
 
 
144
void
 
145
HandleCustomWM_INITMENU(unsigned long hwndIn,
 
146
                        unsigned long hmenuIn);
 
147
 
 
148
Bool
 
149
HandleCustomWM_COMMAND (unsigned long hwndIn,
 
150
                        int           command);
 
151
 
 
152
int
 
153
winIconIsOverride (unsigned hiconIn);
 
154
 
 
155
unsigned long
 
156
winOverrideIcon (unsigned long longpWin);
 
157
 
 
158
unsigned long
 
159
winTaskbarIcon(void);
 
160
 
 
161
unsigned long
 
162
winOverrideDefaultIcon(int size);
 
163
#endif