Contents of /branches/KDE/3.5/kdelibs/kdecore/netwm_def.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 528573 - (show annotations) (download) (as text)
Tue Apr 11 12:48:50 2006 UTC (18 years, 3 months ago) by lunakl
File MIME type: text/x-chdr
File size: 18369 byte(s)
Handle X timestamp wrapping correctly even on 64bit platforms.


1 /*
2
3 Copyright (c) 2000 Troll Tech AS
4 Copyright (c) 2003 Lubos Lunak <[email protected]>
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23
24 */
25
26 #ifndef __netwm_def_h
27 #define __netwm_def_h
28
29 #include <kdelibs_export.h>
30
31 /**
32 Simple point class for NET classes.
33
34 This class is a convenience class defining a point x, y. The existence of
35 this class is to keep the implementation from being dependant on a
36 separate framework/library.
37
38 NETPoint is only used by the NET API. Usually QPoint is the
39 appropriate class for representing a point.
40
41 @author Bradley T. Hughes <[email protected]>
42 **/
43
44 struct NETPoint {
45 /**
46 Constructor to initialize this point to 0,0.
47 **/
48 NETPoint() : x(0), y(0) { }
49
50 /*
51 Public data member.
52 **/
53 int x, ///< x coordinate.
54 y; ///< y coordinate
55 };
56
57
58 /**
59 Simple size class for NET classes.
60
61 This class is a convenience class defining a size width by height. The
62 existence of this class is to keep the implementation from being dependant
63 on a separate framework/library.
64
65 NETSize is only used by the NET API. Usually QSize is the
66 appropriate class for representing a size.
67
68 @author Bradley T. Hughes <[email protected]>
69 **/
70
71 struct NETSize {
72 /**
73 Constructor to initialize this size to 0x0
74 **/
75 NETSize() : width(0), height(0) { }
76
77 /*
78 Public data member.
79 **/
80 int width, ///< Width.
81 height; ///< Height.
82 };
83
84 /**
85 Simple rectangle class for NET classes.
86
87 This class is a convenience class defining a rectangle as a point x,y with a
88 size width by height. The existence of this class is to keep the implementation
89 from being dependant on a separate framework/library;
90
91 NETRect is only used by the NET API. Usually QRect is the
92 appropriate class for representing a rectangle.
93 **/
94 struct NETRect {
95 /**
96 Position of the rectangle.
97
98 @see NETPoint
99 **/
100 NETPoint pos;
101
102 /**
103 Size of the rectangle.
104
105 @see NETSize
106 **/
107 NETSize size;
108 };
109
110
111 /**
112 Simple icon class for NET classes.
113
114 This class is a convenience class defining an icon of size width by height.
115 The existence of this class is to keep the implementation from being
116 dependant on a separate framework/library.
117
118 NETIcon is only used by the NET API. Usually QIcon is the
119 appropriate class for representing an icon.
120 **/
121
122 struct NETIcon {
123 /**
124 Constructor to initialize this icon to 0x0 with data=0
125 **/
126 NETIcon() : data(0) { }
127
128 /**
129 Size of the icon.
130
131 @see NETSize
132 **/
133 NETSize size;
134
135 /**
136 Image data for the icon. This is an array of 32bit packed CARDINAL ARGB
137 with high byte being A, low byte being B. First two bytes are width, height.
138 Data is in rows, left to right and top to bottom.
139 **/
140 unsigned char *data;
141 };
142
143
144 /**
145 Partial strut class for NET classes.
146
147 This class is a convenience class defining a strut with left, right, top and
148 bottom border values, and ranges for them. The existence of this class is to
149 keep the implementation from being dependant on a separate framework/library.
150 See the _NET_WM_STRUT_PARTIAL property in the NETWM spec.
151 **/
152
153 struct NETExtendedStrut {
154 /**
155 Constructor to initialize this struct to 0,0,0,0
156 **/
157 NETExtendedStrut() : left_width(0), left_start(0), left_end(0),
158 right_width(0), right_start(0), right_end(0), top_width(0), top_start(0), top_end(0),
159 bottom_width(0), bottom_start(0), bottom_end(0) {}
160
161 /**
162 Left border of the strut, width and range.
163 **/
164 int left_width, left_start, left_end;
165
166 /**
167 Right border of the strut, width and range.
168 **/
169 int right_width, right_start, right_end;
170
171 /**
172 Top border of the strut, width and range.
173 **/
174 int top_width, top_start, top_end;
175
176 /**
177 Bottom border of the strut, width and range.
178 **/
179 int bottom_width, bottom_start, bottom_end;
180
181 };
182
183
184 /**
185 @deprecated use NETExtendedStrut
186
187 Simple strut class for NET classes.
188
189 This class is a convenience class defining a strut with left, right, top and
190 bottom border values. The existence of this class is to keep the implementation
191 from being dependant on a separate framework/library. See the _NET_WM_STRUT
192 property in the NETWM spec.
193 **/
194
195 struct NETStrut {
196 /**
197 Constructor to initialize this struct to 0,0,0,0
198 **/
199 NETStrut() : left(0), right(0), top(0), bottom(0) { }
200
201 /**
202 Left border of the strut.
203 **/
204 int left;
205
206 /**
207 Right border of the strut.
208 **/
209 int right;
210
211 /**
212 Top border of the strut.
213 **/
214 int top;
215
216 /**
217 Bottom border of the strut.
218 **/
219 int bottom;
220 };
221
222
223 /**
224 Base namespace class.
225
226 The NET API is an implementation of the NET Window Manager Specification.
227
228 This class is the base class for the NETRootInfo and NETWinInfo classes, which
229 are used to retrieve and modify the properties of windows. To keep
230 the namespace relatively clean, all enums are defined here.
231
232 @see http://www.freedesktop.org/standards/wm-spec/
233 **/
234
235 class KDECORE_EXPORT NET {
236 public:
237 /**
238 Application role. This is used internally to determine how several action
239 should be performed (if at all).
240
241 @li Client indicates that the application is a client application.
242
243 @li WindowManager indicates that the application is a window manager
244 application.
245 **/
246
247 enum Role {
248 Client,
249 WindowManager
250 };
251
252 /**
253 Window type.
254
255 @li Unknown indicates that the window did not define a window type.
256
257 @li Normal indicates that this is a normal, top-level window. Windows with
258 Unknown window type or WM_TRANSIENT_FOR unset must be taken as this type.
259
260 @li Desktop indicates a desktop feature. This can include a single window
261 containing desktop icons with the same dimensions as the screen, allowing
262 the desktop environment to have full control of the desktop, without the
263 need for proxying root window clicks.
264
265 @li Dock indicates a dock or panel feature. Typically a window manager would
266 keep such windows on top of all other windows.
267
268 @li Toolbar and Menu indicate toolbar and pinnable menu windows, respectively.
269
270 @li Dialog indicates that this is a dialog window. If _NET_WM_WINDOW_TYPE is
271 not set, then windows with WM_TRANSIENT_FOR set must be taken as this type.
272
273 @li Override indicates that this window wants to have no Window Manager
274 decorations. This is for windows that would normally use either override_redirect
275 or Motif hints to give no decorations. This is a KDE extension to the
276 _NET_WM_WINDOW_TYPE mechanism.
277
278 @li TopMenu indicates a toplevel menu (AKA macmenu). This is a KDE extension to the
279 _NET_WM_WINDOW_TYPE mechanism.
280 **/
281
282 enum WindowType {
283 Unknown = -1,
284 Normal = 0,
285 Desktop = 1,
286 Dock = 2,
287 Toolbar = 3,
288 Menu = 4,
289 Dialog = 5,
290 Override = 6, // NON STANDARD
291 TopMenu = 7, // NON STANDARD
292 Tool = Toolbar, // This will go away soon, COMPAT (How soon? :)
293 Utility = 8, ///< @since 3.2
294 Splash = 9 ///< @since 3.2
295 };
296
297 /**
298 Values for WindowType when they should be OR'ed together, e.g.
299 for the properties argument of the NETRootInfo constructor.
300 @since 3.2
301 **/
302 enum WindowTypeMask {
303 NormalMask = 1<<0,
304 DesktopMask = 1<<1,
305 DockMask = 1<<2,
306 ToolbarMask = 1<<3,
307 MenuMask = 1<<4,
308 DialogMask = 1<<5,
309 OverrideMask = 1<<6,
310 TopMenuMask = 1<<7,
311 UtilityMask = 1<<8,
312 SplashMask = 1<<9
313 };
314
315 // KDE4 move to WindowTypeMask
316 enum { AllTypesMask = 0LU-1 };
317
318 /**
319 * Returns true if the given window type matches the mask given
320 * using WindowTypeMask flags.
321 */
322 static bool typeMatchesMask( WindowType type, unsigned long mask );
323
324 /**
325 Window state.
326
327 @li Modal ndicates that this is a modal dialog box. The WM_TRANSIENT_FOR hint
328 MUST be set to indicate which window the dialog is a modal for, or set to
329 the root window if the dialog is a modal for its window group.
330
331 @li Sticky indicates that the Window Manager SHOULD keep the window's position
332 fixed on the screen, even when the virtual desktop scrolls. Note that this is
333 different from being kept on all desktops.
334
335 @li Max{Vert,Horiz} indicates that the window is {vertically,horizontally}
336 maximized.
337
338 @li Max is more convenient than MaxVert | MaxHoriz.
339
340 @li Shaded indicates that the window is shaded (rolled-up).
341
342 @li SkipTaskbar indicates that a window should not be included on a taskbar.
343
344 @li SkipPager indicates that a window should not be included on a pager.
345
346 @li Hidden indicates that a window should not be visible on the screen (e.g. when minimised).
347 Only the window manager is allowed to change it.
348
349 @li FullScreen indicates that a window should fill the entire screen and have no window decorations.
350
351 @li KeepAbove indicates that a window should on top of most windows (but below fullscreen windows).
352
353 @li KeepBelow indicates that a window should be below most windows (but above any desktop windows).
354
355 @li StaysOnTop is an obsolete name for KeepAbove.
356
357 @li DemandsAttention there was an attempt to activate this window, but the window manager prevented
358 this. E.g. taskbar should mark such window specially to bring user's attention to this window.
359 Only the window manager is allowed to change it.
360
361 Note that KeepAbove (StaysOnTop) and KeepBelow are meant as user preference and applications
362 should avoid setting these states themselves.
363 **/
364
365 enum State {
366 Modal = 1<<0,
367 Sticky = 1<<1,
368 MaxVert = 1<<2,
369 MaxHoriz = 1<<3,
370 Max = MaxVert | MaxHoriz,
371 Shaded = 1<<4,
372 SkipTaskbar = 1<<5,
373 KeepAbove = 1<<6, ///< @since 3.2
374 StaysOnTop = KeepAbove, // NOT STANDARD
375 SkipPager = 1<<7,
376 Hidden = 1<<8, ///< @since 3.2
377 FullScreen = 1<<9, ///< @since 3.2
378 KeepBelow = 1<<10, ///< @since 3.2
379 DemandsAttention = 1<<11 ///< @since 3.2
380 };
381
382 /**
383 Direction for WMMoveResize.
384
385 When a client wants the Window Manager to start a WMMoveResize, it should
386 specify one of:
387
388 @li TopLeft
389 @li Top
390 @li TopRight
391 @li Right
392 @li BottomRight
393 @li Bottom
394 @li BottomLeft
395 @li Left
396 @li Move (for movement only)
397 @li KeyboardSize (resizing via keyboard)
398 @li KeyboardMove (movement via keyboard)
399 **/
400
401 enum Direction {
402 TopLeft = 0,
403 Top = 1,
404 TopRight = 2,
405 Right = 3,
406 BottomRight = 4,
407 Bottom = 5,
408 BottomLeft = 6,
409 Left = 7,
410 Move = 8, // movement only
411 /**
412 @since 3.2
413 **/
414 KeyboardSize = 9, // size via keyboard
415 /**
416 @since 3.2
417 **/
418 KeyboardMove = 10, // move via keyboard
419 /**
420 @since 3.5.1
421 **/
422 MoveResizeCancel = 11 // to ask the WM to stop moving a window
423 };
424
425 /**
426 Client window mapping state. The class automatically watches the mapping
427 state of the client windows, and uses the mapping state to determine how
428 to set/change different properties.
429
430 @li Visible indicates the client window is visible to the user.
431
432 @li Withdrawn indicates that neither the client window nor its icon is visible.
433
434 @li Iconic indicates that the client window is not visible, but its icon is.
435 This can be when the window is minimized or when it's on a different
436 virtual desktop. See also NET::Hidden.
437 **/
438
439 // KDE4 aaarghl, this doesn't map correctly to Xlib #defines
440 enum MappingState {
441 Visible, // ie. NormalState
442 Withdrawn,
443 Iconic
444 };
445
446 /**
447 Actions that can be done with a window (_NET_WM_ALLOWED_ACTIONS).
448 @since 3.2
449 **/
450 enum Action {
451 ActionMove = 1<<0,
452 ActionResize = 1<<1,
453 ActionMinimize = 1<<2,
454 ActionShade = 1<<3,
455 ActionStick = 1<<4,
456 ActionMaxVert = 1<<5,
457 ActionMaxHoriz = 1<<6,
458 ActionMax = ActionMaxVert | ActionMaxHoriz,
459 ActionFullScreen = 1<<7,
460 ActionChangeDesktop = 1<<8,
461 ActionClose = 1<<9
462 };
463
464 /**
465 Supported properties. Clients and Window Managers must define which
466 properties/protocols it wants to support.
467
468 Root/Desktop window properties and protocols:
469
470 @li Supported
471 @li ClientList
472 @li ClientListStacking
473 @li NumberOfDesktops
474 @li DesktopGeometry
475 @li DesktopViewport
476 @li CurrentDesktop
477 @li DesktopNames
478 @li ActiveWindow
479 @li WorkArea
480 @li SupportingWMCheck
481 @li VirtualRoots
482 @li CloseWindow
483 @li WMMoveResize
484
485 Client window properties and protocols:
486
487 @li WMName
488 @li WMVisibleName
489 @li WMDesktop
490 @li WMWindowType
491 @li WMState
492 @li WMStrut (obsoleted by WM2ExtendedStrut)
493 @li WMIconGeometry
494 @li WMIcon
495 @li WMPid
496 @li WMVisibleIconName
497 @li WMIconName
498
499 ICCCM properties (provided for convenience):
500
501 @li XAWMState
502
503 Extended KDE protocols and properties (NOT STANDARD):
504
505 @li KDESystemTrayWindows
506 @li WMKDESystemTrayWinFor
507 @li WMKDEFrameStrut
508 **/
509
510 enum Property {
511 // root
512 Supported = 1<<0,
513 ClientList = 1<<1,
514 ClientListStacking = 1<<2,
515 NumberOfDesktops = 1<<3,
516 DesktopGeometry = 1<<4,
517 DesktopViewport = 1<<5,
518 CurrentDesktop = 1<<6,
519 DesktopNames = 1<<7,
520 ActiveWindow = 1<<8,
521 WorkArea = 1<<9,
522 SupportingWMCheck = 1<<10,
523 VirtualRoots = 1<<11,
524 KDESystemTrayWindows = 1<<12, // NOT STANDARD
525 CloseWindow = 1<<13,
526 WMMoveResize = 1<<14,
527
528 // window
529 WMName = 1<<15,
530 WMVisibleName = 1<<16,
531 WMDesktop = 1<<17,
532 WMWindowType = 1<<18,
533 WMState = 1<<19,
534 WMStrut = 1<<20,
535 WMIconGeometry = 1<<21,
536 WMIcon = 1<<22,
537 WMPid = 1<<23,
538 WMHandledIcons = 1<<24,
539 WMPing = 1<<25,
540 WMKDESystemTrayWinFor = 1<<26, // NOT STANDARD
541 XAWMState = 1<<27, // NOT STANDARD
542 WMFrameExtents = 1<<28, ///< @since 3.5
543 WMKDEFrameStrut = WMFrameExtents, // NOT STANDARD
544
545 // Need to be reordered
546 WMIconName = 1<<29,
547 WMVisibleIconName = 1<<30,
548 WMGeometry = 1<<31
549 };
550
551 /**
552 Supported properties. This enum is an extension to NET::Property,
553 because them enum is limited only to 32 bits.
554
555 Client window properties and protocols:
556
557 @li WM2UserTime
558 @li WM2StartupId
559 @li WM2TransientFor mainwindow for the window (WM_TRANSIENT_FOR)
560 @li WM2GroupLeader group leader (window_group in WM_HINTS)
561 @li WM2AllowedActions
562 @li WM2RestackWindow
563 @li WM2MoveResizeWindow
564 @li WM2ExtendedStrut
565 @li WM2TemporaryRules internal, for kstart
566 @li WM2WindowClass WM_CLASS
567 @li WM2WindowRole WM_WINDOW_ROLE
568 @li WM2ClientMachine WM_CLIENT_MACHINE
569
570 @since 3.2
571
572 **/
573 enum Property2 {
574 WM2UserTime = 1<<0,
575 WM2StartupId = 1<<1,
576 WM2TransientFor = 1<<2,
577 WM2GroupLeader = 1<<3,
578 WM2AllowedActions = 1<<4,
579 WM2RestackWindow = 1<<5,
580 WM2MoveResizeWindow = 1<<6,
581 WM2ExtendedStrut = 1<<7,
582 WM2TakeActivity = 1<<8,
583 WM2KDETemporaryRules = 1<<9, // NOT STANDARD
584 WM2WindowClass = 1<<10, ///< @since 3.3
585 WM2WindowRole = 1<<11, ///< @since 3.3
586 WM2ClientMachine = 1<<12, ///< @since 3.3
587 WM2ShowingDesktop = 1<<13 ///< @since 3.5
588 };
589
590 /**
591 Sentinel value to indicate that the client wishes to be visible on
592 all desktops.
593 @since 3.2
594 **/
595 enum { OnAllDesktops = -1 };
596
597 /**
598 Source of the request.
599 @li FromApplication the request comes from a normal application
600 @li FromTool the request comes from pager or similar tool
601 @since 3.2
602 **/
603 // must match the values for data.l[0] field in _NET_ACTIVE_WINDOW message
604 enum RequestSource {
605 FromUnknown, // internal
606 FromApplication,
607 FromTool
608 };
609
610 /**
611 Compares two X timestamps, taking into account wrapping and 64bit architectures.
612 Return value is like with strcmp(), 0 for equal, -1 for time1 < time2, 1 for time1 > time2.
613 @since 3.5.3
614 */
615 static int timestampCompare( unsigned long time1, unsigned long time2 );
616 /**
617 Returns a difference of two X timestamps, time2 - time1, where time2 must be later than time1,
618 as returned by timestampCompare().
619 @since 3.5.3
620 */
621 static int timestampDiff( unsigned long time1_, unsigned long time2_ );
622
623 };
624
625
626 #endif // __netwm_def_h

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision
svn:mime-type text/x-chdr