| 1 |
/* $XConsortium: wsm_proto.h /main/5 1995/07/15 20:39:12 drk $ */ |
| 2 |
/* |
| 3 |
* Motif |
| 4 |
* |
| 5 |
* Copyright (c) 1987-2012, The Open Group. All rights reserved. |
| 6 |
* |
| 7 |
* These libraries and programs are free software; you can |
| 8 |
* redistribute them and/or modify them under the terms of the GNU |
| 9 |
* Lesser General Public License as published by the Free Software |
| 10 |
* Foundation; either version 2 of the License, or (at your option) |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* These libraries and programs are distributed in the hope that |
| 14 |
* they will be useful, but WITHOUT ANY WARRANTY; without even the |
| 15 |
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 16 |
* PURPOSE. See the GNU Lesser General Public License for more |
| 17 |
* details. |
| 18 |
* |
| 19 |
* You should have received a copy of the GNU Lesser General Public |
| 20 |
* License along with these librararies and programs; if not, write |
| 21 |
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth |
| 22 |
* Floor, Boston, MA 02110-1301 USA |
| 23 |
* |
| 24 |
*/ |
| 25 |
/* |
| 26 |
* HISTORY |
| 27 |
*/ |
| 28 |
|
| 29 |
#ifndef _WSM_PROTO_ |
| 30 |
#define _WSM_PROTO_ |
| 31 |
|
| 32 |
#include <stdio.h> |
| 33 |
#include <X11/Intrinsic.h> |
| 34 |
#include <X11/Xmd.h> |
| 35 |
#include <Xm/Xm.h> |
| 36 |
|
| 37 |
#define WSM_PROTO_FMT 8 |
| 38 |
|
| 39 |
/************************************************************ |
| 40 |
* |
| 41 |
* Defines |
| 42 |
* |
| 43 |
************************************************************/ |
| 44 |
|
| 45 |
#define WSM_NAME_CONNECT "_MOTIF_WSM_CONNECT" |
| 46 |
#define WSM_NAME_EXTENSIONS "_MOTIF_WM_EXTENSIONS" |
| 47 |
#define WSM_NAME_CONFIG_FMT "_MOTIF_WM_CONFIG_FORMAT" |
| 48 |
#define WSM_NAME_GET_STATE "_MOTIF_WSM_GET_STATE" |
| 49 |
#define WSM_NAME_SET_STATE "_MOTIF_WSM_SET_STATE" |
| 50 |
#define WSM_NAME_REG_WINDOW "_MOTIF_WSM_REGISTER_WINDOW" |
| 51 |
#define WSM_NAME_WM_GET_BACKGROUND_WINDOW "_MOTIF_WSM_GET_BACKGROUND_WINDOW" |
| 52 |
#define WSM_NAME_WM_SET_BACKGROUND_WINDOW "_MOTIF_WSM_SET_BACKGROUND_WINDOW" |
| 53 |
#define WSM_NAME_WM_WINDOWS "_MOTIF_WSM_WM_WINDOWS" |
| 54 |
#define WSM_NAME_WM_FOCUS "_MOTIF_WSM_WM_FOCUS" |
| 55 |
#define WSM_NAME_WM_POINTER "_MOTIF_WSM_WM_POINTER" |
| 56 |
|
| 57 |
#define NUM_EXTRA_TARGETS 3 |
| 58 |
#define NUM_WSM_TARGETS 11 |
| 59 |
|
| 60 |
#define WM_SELECTION_FORMAT "WM_S%d" |
| 61 |
#define WSM_SELECTION_FORMAT "WSM_S%d" |
| 62 |
|
| 63 |
#define WIN_MASK 0x1FFFFFFF |
| 64 |
|
| 65 |
/************************************************************ |
| 66 |
* |
| 67 |
* New enumerated types. |
| 68 |
* |
| 69 |
************************************************************/ |
| 70 |
|
| 71 |
typedef enum {WSM_CONNECT, WSM_EXTENSIONS, WSM_CONFIG_FMT, WSM_GET_STATE, |
| 72 |
WSM_SET_STATE, WSM_REG_WINDOW, |
| 73 |
WSM_WM_GET_BACKGROUND_WINDOW, WSM_WM_SET_BACKGROUND_WINDOW, |
| 74 |
WSM_WM_WINDOWS, WSM_WM_FOCUS, WSM_WM_POINTER, |
| 75 |
WSM_UNKNOWN} WSMRequestType; |
| 76 |
|
| 77 |
typedef enum {WSM_WORKSPACE_MANAGER, WSM_WINDOW_MANAGER} WSMClientType; |
| 78 |
|
| 79 |
typedef enum {WSM_GLOBAL_FMT = 0, |
| 80 |
WSM_WINDOW_FMT = 1, WSM_ICON_FMT = 2} WSMConfigFormatType; |
| 81 |
|
| 82 |
typedef enum {WSM_VALUE_DATA, WSM_CHAR_LIST_DATA, |
| 83 |
WSM_SHORT_LIST_DATA, WSM_LONG_LIST_DATA, WSM_NONE} WSMDataType; |
| 84 |
|
| 85 |
typedef enum {WSM_SUCCESS, WSM_ERROR_INTERNAL, WSM_ERROR_CONVERSION_FAILED, |
| 86 |
WSM_ERROR_NO_SEL_OWNER, WSM_ERROR_TIMEOUT, |
| 87 |
WSM_ERROR_NO_CONFIG_FORMAT, |
| 88 |
WSM_ERROR_ALREADY_HAVE_CONFIG_FORMAT } WSMErrorCode; |
| 89 |
|
| 90 |
typedef enum {WSM_CLIENT_WINDOW, WSM_CLIENT_FRAME, WSM_ICON_FRAME} WSMLocationFlag; |
| 91 |
|
| 92 |
typedef XtPointer MessageData; |
| 93 |
|
| 94 |
/************************************************************ |
| 95 |
* |
| 96 |
* Global structures that are used by calling routines. |
| 97 |
* |
| 98 |
************************************************************/ |
| 99 |
|
| 100 |
typedef union _WSMData { |
| 101 |
long value; |
| 102 |
char * char_ptr; |
| 103 |
short * short_ptr; |
| 104 |
long * long_ptr; |
| 105 |
} WSMData; |
| 106 |
|
| 107 |
typedef struct _WSMAttribute { |
| 108 |
XrmQuark nameq; /* Name of this attribute, quarkified. */ |
| 109 |
int size; /* The size of this attribute. */ |
| 110 |
Boolean is_list; /* True if this attribute is a list. */ |
| 111 |
} WSMAttribute; |
| 112 |
|
| 113 |
typedef struct _WSMConfigFormatData { |
| 114 |
WSMAttribute *attr_list; |
| 115 |
int num_attrs; |
| 116 |
} WSMConfigFormatData; |
| 117 |
|
| 118 |
typedef struct _WSMWinData { |
| 119 |
XrmQuark nameq; /* Name of this data entry, quarkified. */ |
| 120 |
WSMDataType type; /* The type of data stored in data. */ |
| 121 |
WSMData data; /* The data associated with this data entry. */ |
| 122 |
int data_len; /* if a list, then the size. */ |
| 123 |
} WSMWinData; |
| 124 |
|
| 125 |
typedef struct _WSMWinInfo { |
| 126 |
Window window; |
| 127 |
WSMWinData * data_list; |
| 128 |
int num_data_list; |
| 129 |
} WSMWinInfo; |
| 130 |
|
| 131 |
typedef Atom WindowProperty; |
| 132 |
|
| 133 |
typedef struct _WSMWinEntry { |
| 134 |
Window *windows; /* one for each location flag set. */ |
| 135 |
int num_windows; |
| 136 |
WindowProperty *match_properties; /* properties the window matched. */ |
| 137 |
int num_match_properties; |
| 138 |
} WSMWinEntry; |
| 139 |
|
| 140 |
typedef struct _AttributePair { |
| 141 |
WindowProperty *allowed_attributes; |
| 142 |
WindowProperty *prohibited_attributes; |
| 143 |
int num_attributes; |
| 144 |
} AttributePair; |
| 145 |
|
| 146 |
/************************************************************ |
| 147 |
* |
| 148 |
* Structures for sending a message for each type of event |
| 149 |
* |
| 150 |
************************************************************/ |
| 151 |
|
| 152 |
typedef struct _WSMAnyRequestOrReply { |
| 153 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 154 |
Boolean allocated; /* Packlib allocated the data, do not move. */ |
| 155 |
} WSMAnyRequestOrReply; |
| 156 |
|
| 157 |
typedef struct _WSMConnect { |
| 158 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 159 |
|
| 160 |
/* |
| 161 |
* Packlib allocated the data, do not move. |
| 162 |
* If True will free the known_versions ptr. |
| 163 |
*/ |
| 164 |
|
| 165 |
Boolean allocated; |
| 166 |
short * known_versions; |
| 167 |
int num_versions; |
| 168 |
} WSMConnect; |
| 169 |
|
| 170 |
typedef struct _WSMExtensions { |
| 171 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 172 |
|
| 173 |
/* |
| 174 |
* Packlib allocated the data, do not move. |
| 175 |
* If True will free each string on the extension_suggestions list |
| 176 |
* as well as the extension_suggestions ptr itself. |
| 177 |
*/ |
| 178 |
|
| 179 |
Boolean allocated; |
| 180 |
String *extension_suggestions; |
| 181 |
int num_extensions; |
| 182 |
} WSMExtensions; |
| 183 |
|
| 184 |
typedef WSMAnyRequestOrReply WSMConfigFormat; |
| 185 |
|
| 186 |
typedef struct _WSMGetState { |
| 187 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 188 |
Boolean allocated; /* Packlib allocated the data, do not move. */ |
| 189 |
Window window; |
| 190 |
Boolean diffs_allowed; |
| 191 |
} WSMGetState; |
| 192 |
|
| 193 |
typedef struct _WSMSetState { |
| 194 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 195 |
|
| 196 |
/* |
| 197 |
* Packlib allocated the data, do not move. |
| 198 |
* If True will free the win_data list in each element on the |
| 199 |
* win_info_list. as well as the win_info_list ptr itself. |
| 200 |
*/ |
| 201 |
|
| 202 |
Boolean allocated; |
| 203 |
WSMWinInfo *win_info_list; |
| 204 |
int num_win_info_list; |
| 205 |
} WSMSetState; |
| 206 |
|
| 207 |
typedef struct _WSMRegisterWindow { |
| 208 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 209 |
Boolean allocated; /* Packlib allocated the data, do not move. */ |
| 210 |
Window window; |
| 211 |
} WSMRegisterWindow; |
| 212 |
|
| 213 |
typedef struct _WSMWmGetBackgroundWindow { |
| 214 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 215 |
Boolean allocated; |
| 216 |
|
| 217 |
int screen; |
| 218 |
} WSMWmGetBackgroundWindow; |
| 219 |
|
| 220 |
typedef struct _WSMWmSetBackgroundWindow { |
| 221 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 222 |
Boolean allocated; |
| 223 |
|
| 224 |
Window window; |
| 225 |
} WSMWmSetBackgroundWindow; |
| 226 |
|
| 227 |
typedef struct _WSMWmWindows { |
| 228 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 229 |
Boolean allocated; |
| 230 |
|
| 231 |
CARD32 location_flag; |
| 232 |
WindowProperty *window_properties; |
| 233 |
int num_window_properties; |
| 234 |
AttributePair **match_attributes; |
| 235 |
int num_match_attributes; |
| 236 |
} WSMWmWindows; |
| 237 |
|
| 238 |
typedef WSMAnyRequestOrReply WSMWmFocus; |
| 239 |
|
| 240 |
typedef WSMAnyRequestOrReply WSMWmPointer; |
| 241 |
|
| 242 |
typedef union _WSMRequest { |
| 243 |
WSMAnyRequestOrReply any; |
| 244 |
WSMConnect connect; |
| 245 |
WSMExtensions extensions; |
| 246 |
WSMConfigFormat config_format; |
| 247 |
WSMGetState get_state; |
| 248 |
WSMSetState set_state; |
| 249 |
WSMRegisterWindow register_window; |
| 250 |
WSMWmGetBackgroundWindow get_background; |
| 251 |
WSMWmSetBackgroundWindow set_background; |
| 252 |
WSMWmWindows wm_windows; |
| 253 |
WSMWmFocus wm_focus; |
| 254 |
WSMWmPointer wm_pointer; |
| 255 |
} WSMRequest; |
| 256 |
|
| 257 |
/************************************************************ |
| 258 |
* |
| 259 |
* Structures for recieving a reply message for each type of event. |
| 260 |
* |
| 261 |
************************************************************/ |
| 262 |
|
| 263 |
typedef struct _WSMConnectReply { |
| 264 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 265 |
Boolean allocated; /* Packlib allocated the data, do not move. */ |
| 266 |
short version; |
| 267 |
} WSMConnectReply; |
| 268 |
|
| 269 |
typedef struct _WSMExtensionsReply { |
| 270 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 271 |
|
| 272 |
/* |
| 273 |
* Packlib allocated the data, do not move. |
| 274 |
* If True will free each string on the extensions list |
| 275 |
* as well as the extensions ptr itself. |
| 276 |
*/ |
| 277 |
|
| 278 |
Boolean allocated; |
| 279 |
String *extensions; |
| 280 |
int num_extensions; |
| 281 |
} WSMExtensionsReply; |
| 282 |
|
| 283 |
typedef struct _WSMConfigFormatReply { |
| 284 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 285 |
Boolean allocated; /* Packlib allocated the data, do not move. */ |
| 286 |
Boolean accepts_diffs; |
| 287 |
WSMAttribute * global_formats; |
| 288 |
int num_global_formats; |
| 289 |
WSMAttribute * window_formats; |
| 290 |
int num_window_formats; |
| 291 |
WSMAttribute * icon_formats; |
| 292 |
int num_icon_formats; |
| 293 |
} WSMConfigFormatReply; |
| 294 |
|
| 295 |
typedef struct _WSMGetStateReply { |
| 296 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 297 |
|
| 298 |
/* |
| 299 |
* Packlib allocated the data, do not move. |
| 300 |
* If True will free the win_data list in each element on the |
| 301 |
* win_info_list. as well as the win_info_list ptr itself. |
| 302 |
*/ |
| 303 |
|
| 304 |
Boolean allocated; |
| 305 |
WSMWinInfo *win_info_list; |
| 306 |
int num_win_info_list; |
| 307 |
} WSMGetStateReply; |
| 308 |
|
| 309 |
typedef WSMAnyRequestOrReply WSMSetStateReply; |
| 310 |
|
| 311 |
typedef struct _WSMRegisterWindowReply { |
| 312 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 313 |
|
| 314 |
/* |
| 315 |
* Packlib allocated the data, do not move. |
| 316 |
* If True will free the window_data pointer. |
| 317 |
*/ |
| 318 |
|
| 319 |
Boolean allocated; |
| 320 |
WSMWinData * window_data; |
| 321 |
int num_window_data; |
| 322 |
} WSMRegisterWindowReply; |
| 323 |
|
| 324 |
typedef struct _WSMWmGetBackgroundWindowReply { |
| 325 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 326 |
Boolean allocated; |
| 327 |
|
| 328 |
Window window; |
| 329 |
} WSMWmGetBackgroundWindowReply; |
| 330 |
|
| 331 |
typedef struct _WSMWmSetBackgroundWindowReply { |
| 332 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 333 |
Boolean allocated; |
| 334 |
|
| 335 |
Window window; |
| 336 |
} WSMWmSetBackgroundWindowReply; |
| 337 |
|
| 338 |
typedef struct _WSMWmWindowsReply { |
| 339 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 340 |
Boolean allocated; |
| 341 |
|
| 342 |
WSMWinEntry *win_entry_list; |
| 343 |
int num_win_entry_list; |
| 344 |
} WSMWmWindowsReply; |
| 345 |
|
| 346 |
typedef struct _WSMWmFocusReply { |
| 347 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 348 |
Boolean allocated; |
| 349 |
|
| 350 |
Window window; |
| 351 |
} WSMWmFocusReply; |
| 352 |
|
| 353 |
typedef struct _WSMWmPointerReply { |
| 354 |
WSMRequestType type; /* Type of event, do not move or change. */ |
| 355 |
Boolean allocated; |
| 356 |
|
| 357 |
Window window; |
| 358 |
CARD32 location_flag; /* client, frame, icon. */ |
| 359 |
} WSMWmPointerReply; |
| 360 |
|
| 361 |
typedef union _WSMReply { |
| 362 |
WSMAnyRequestOrReply any; |
| 363 |
WSMConnectReply connect; |
| 364 |
WSMExtensionsReply extensions; |
| 365 |
WSMConfigFormatReply config_format; |
| 366 |
WSMGetStateReply get_state; |
| 367 |
WSMSetStateReply set_state; |
| 368 |
WSMRegisterWindowReply register_window; |
| 369 |
WSMWmGetBackgroundWindowReply get_background; |
| 370 |
WSMWmSetBackgroundWindowReply set_background; |
| 371 |
WSMWmWindowsReply wm_windows; |
| 372 |
WSMWmFocusReply wm_focus; |
| 373 |
WSMWmPointerReply wm_pointer; |
| 374 |
} WSMReply; |
| 375 |
|
| 376 |
/************************************************************ |
| 377 |
* |
| 378 |
* New function types. |
| 379 |
* |
| 380 |
************************************************************/ |
| 381 |
typedef void (*WSMReplyCallbackFunc)( |
| 382 |
Widget, /* A Widget on the same screen as the */ |
| 383 |
/* client that we are talking to. */ |
| 384 |
XtPointer, /* The user data. */ |
| 385 |
WSMReply *, /* The reply structure. */ |
| 386 |
WSMErrorCode /* The error code, or WSM_SUCCESS. */ |
| 387 |
); |
| 388 |
|
| 389 |
typedef void (*WSMRequestCallbackFunc) ( |
| 390 |
Widget, /* A Widget on the same screen as the */ |
| 391 |
/* client that we are talking to. */ |
| 392 |
XtPointer, /* The user data. */ |
| 393 |
WSMRequest *, /* The request made of us. */ |
| 394 |
WSMReply * /* A reply structure that the user should */ |
| 395 |
/* fill in with the reply to send back. */ |
| 396 |
); |
| 397 |
|
| 398 |
/************************************************************ |
| 399 |
* |
| 400 |
* These depend on lots of stuff above, and must go last. |
| 401 |
* |
| 402 |
************************************************************/ |
| 403 |
|
| 404 |
/* |
| 405 |
* There is an assumption that there is only one WM and WSM per screen |
| 406 |
* and therefore the config_data can be stored in the screen info. |
| 407 |
* This seems pretty safe. |
| 408 |
*/ |
| 409 |
|
| 410 |
typedef struct _WSMScreenInfo { |
| 411 |
int screen_num; |
| 412 |
Atom wsm_selection; |
| 413 |
Atom wm_selection; |
| 414 |
WSMConfigFormatData global; |
| 415 |
WSMConfigFormatData window; |
| 416 |
WSMConfigFormatData icon; |
| 417 |
WSMRequestCallbackFunc request_callback; |
| 418 |
XtPointer request_data; |
| 419 |
struct _WSMScreenInfo *next; |
| 420 |
} WSMScreenInfo; |
| 421 |
|
| 422 |
typedef struct _WSMDispInfo { |
| 423 |
Display *disp; |
| 424 |
Atom connect; |
| 425 |
Atom extensions; |
| 426 |
Atom config_fmt; |
| 427 |
Atom get_state; |
| 428 |
Atom set_state; |
| 429 |
Atom reg_window; |
| 430 |
Atom get_background; |
| 431 |
Atom set_background; |
| 432 |
Atom wm_windows; |
| 433 |
Atom wm_focus; |
| 434 |
Atom wm_pointer; |
| 435 |
Atom targets, multiple, timestamp; /* Required default targets. */ |
| 436 |
WSMScreenInfo *screen_info; |
| 437 |
struct _WSMDispInfo *next; |
| 438 |
} WSMDispInfo; |
| 439 |
|
| 440 |
#include "wsm_funcs.h" |
| 441 |
|
| 442 |
#endif /* _WSM_PROTO_ --- Do not add anything after this line. */ |