9 #include <pango/pango.h>
12 #include <WINGs/WINGs.h>
14 #if WINGS_H_VERSION < 20041030
15 #error There_is_an_old_WINGs.h_file_somewhere_in_your_system._Please_remove_it.
27 #endif /* __cplusplus */
29 /* ---[ global settigns ]------------------------------------------------- */
31 #define DOUBLE_BUFFER 1
33 #define SCROLLER_WIDTH 20
35 typedef struct _WINGsConfiguration
{
41 unsigned doubleClickDelay
;
42 unsigned mouseWheelUp
;
43 unsigned mouseWheelDown
;
44 } _WINGsConfiguration
;
46 extern char *_WINGS_progname
;
47 extern _WINGsConfiguration WINGsConfiguration
;
48 extern struct W_Application WMApplication
;
51 /* ---[ drag*.c ]--------------------------------------------------------- */
54 * We need to define these structure first because they are used in W_Screen
55 * below. The rest of drag-related stuff if after because it needs W_Screen
57 #define XDND_VERSION 3
59 typedef struct W_DraggingInfo
{
60 unsigned char protocolVersion
; /* version supported on the other side */
64 Atom destinationAction
;
66 struct W_DragSourceInfo
* sourceInfo
; /* infos needed by source */
67 struct W_DragDestinationInfo
* destInfo
; /* infos needed by destination */
70 /* ---[ Structures from WINGs.h ]----------------------------------------- */
72 /* Pre-definition of internal structs */
73 typedef struct W_Color W_Color
;
74 typedef struct W_Pixmap W_Pixmap
;
75 typedef struct W_View W_View
;
77 typedef struct W_FocusInfo
{
79 W_View
*focused
; /* view that has the focus in this toplevel */
80 struct W_FocusInfo
*next
;
83 typedef struct W_Screen
{
100 struct W_IMContext
*imctx
;
102 struct _XftDraw
*xftdraw
; /* shared XftDraw */
104 /* application related */
106 W_FocusInfo
*focusInfo
;
108 RImage
*applicationIconImage
; /* image (can have alpha channel) */
109 W_Pixmap
*applicationIconPixmap
; /* pixmap - no alpha channel */
110 Window applicationIconWindow
;
112 struct W_Window
*windowList
; /* list of windows in the app */
114 Window groupLeader
; /* the leader of the application */
115 /* also used for other things */
117 struct W_SelectionHandlers
*selectionHandlerList
;
120 unsigned int hasAppIcon
:1;
121 unsigned int simpleApplication
:1;
124 WMOpenPanel
*sharedOpenPanel
;
125 WMSavePanel
*sharedSavePanel
;
127 struct W_FontPanel
*sharedFontPanel
;
129 struct W_ColorPanel
*sharedColorPanel
;
133 W_View
*dragSourceView
;
134 W_DraggingInfo dragInfo
;
147 GC monoGC
; /* GC for 1bpp visuals */
151 GC ixorGC
; /* IncludeInferiors XOR */
153 GC drawStringGC
; /* for WMDrawString() */
155 GC drawImStringGC
; /* for WMDrawImageString() */
157 struct W_Font
*normalFont
;
159 struct W_Font
*boldFont
;
161 WMHashTable
*fontCache
;
163 Bool antialiasedText
;
165 unsigned int ignoredModifierMask
; /* modifiers to ignore when typing txt */
167 struct W_Balloon
*balloon
;
170 W_Pixmap
*checkButtonImageOn
;
171 W_Pixmap
*checkButtonImageOff
;
173 W_Pixmap
*radioButtonImageOn
;
174 W_Pixmap
*radioButtonImageOff
;
176 W_Pixmap
*buttonArrow
;
177 W_Pixmap
*pushedButtonArrow
;
179 W_Pixmap
*scrollerDimple
;
184 W_Pixmap
*rightArrow
;
187 W_Pixmap
*hiDownArrow
;
188 W_Pixmap
*hiLeftArrow
;
189 W_Pixmap
*hiRightArrow
;
191 W_Pixmap
*pullDownIndicator
;
192 W_Pixmap
*popUpIndicator
;
197 W_Pixmap
*altHomeIcon
;
199 W_Pixmap
*trashcanIcon
;
200 W_Pixmap
*altTrashcanIcon
;
202 W_Pixmap
*createDirIcon
;
203 W_Pixmap
*altCreateDirIcon
;
205 W_Pixmap
*disketteIcon
;
206 W_Pixmap
*altDisketteIcon
;
207 W_Pixmap
*unmountIcon
;
208 W_Pixmap
*altUnmountIcon
;
210 W_Pixmap
*magnifyIcon
;
211 /*W_Pixmap *altMagnifyIcon;*/
217 W_Pixmap
*customPaletteIcon
;
218 W_Pixmap
*colorListIcon
;
220 W_Pixmap
*defaultObjectIcon
;
222 Cursor defaultCursor
;
226 Cursor invisibleCursor
;
228 Atom attribsAtom
; /* GNUstepWindowAttributes */
230 Atom deleteWindowAtom
; /* WM_DELETE_WINDOW */
232 Atom protocolsAtom
; /* _XA_WM_PROTOCOLS */
234 Atom clipboardAtom
; /* CLIPBOARD */
236 Atom xdndAwareAtom
; /* XdndAware */
237 Atom xdndSelectionAtom
;
240 Atom xdndPositionAtom
;
242 Atom xdndFinishedAtom
;
243 Atom xdndTypeListAtom
;
244 Atom xdndActionListAtom
;
245 Atom xdndActionDescriptionAtom
;
252 Atom xdndActionPrivate
;
254 Atom wmIconDragOffsetAtom
;
256 Atom wmStateAtom
; /* WM_STATE */
264 /* stuff for detecting double-clicks */
265 Time lastClickTime
; /* time of last mousedown event */
266 Window lastClickWindow
; /* window of the last mousedown */
268 struct W_View
*modalView
;
269 unsigned modalLoop
:1;
270 unsigned ignoreNextDoubleClick
:1;
273 * New stuff in Window Maker 0.95.7
274 * Added at the end of the structure to avoid breaking binary compatibility
275 * with previous versions of the toolkit
277 W_Pixmap
*tristateButtonImageOn
;
278 W_Pixmap
*tristateButtonImageOff
;
279 W_Pixmap
*tristateButtonImageTri
;
283 #define W_DRAWABLE(scr) (scr)->rcontext->drawable
286 /* ---[ configuration.c ]------------------------------------------------- */
288 void W_ReadConfigurations(void);
291 /* ---[ drag*.c ]--------------------------------------------------------- */
293 typedef struct W_DragOperationItem
{
294 WMDragOperationType type
;
296 } W_DragOperationItem
;
298 typedef void* W_DndState(WMView
*destView
, XClientMessageEvent
*event
,
299 WMDraggingInfo
*info
);
301 typedef struct W_DragSourceInfo
{
303 Window destinationWindow
;
305 WMSelectionProcs
*selectionProcs
;
307 WMPoint imageLocation
;
308 WMPoint mouseOffset
; /* mouse pos in icon */
310 WMRect noPositionMessageZone
;
311 Atom firstThreeTypes
[3];
314 typedef struct W_DragDestinationInfo
{
316 WMView
*xdndAwareView
;
319 Bool sourceActionChanged
;
320 WMArray
*sourceTypes
;
321 WMArray
*requiredTypes
;
322 Bool typeListAvailable
;
324 } W_DragDestinationInfo
;
326 /* -- Functions -- */
328 void W_HandleDNDClientMessage(WMView
*toplevel
, XClientMessageEvent
*event
);
330 Atom
W_OperationToAction(WMScreen
*scr
, WMDragOperationType operation
);
332 WMDragOperationType
W_ActionToOperation(WMScreen
*scr
, Atom action
);
334 void W_FreeDragOperationItem(void* item
);
336 Bool
W_SendDnDClientMessage(Display
*dpy
, Window win
, Atom message
,
337 unsigned long data1
, unsigned long data2
,
338 unsigned long data3
, unsigned long data4
,
339 unsigned long data5
);
341 void W_DragSourceStartTimer(WMDraggingInfo
*info
);
343 void W_DragSourceStopTimer(void);
345 void W_DragSourceStateHandler(WMDraggingInfo
*info
, XClientMessageEvent
*event
);
347 void W_DragDestinationStartTimer(WMDraggingInfo
*info
);
349 void W_DragDestinationStopTimer(void);
351 void W_DragDestinationStoreEnterMsgInfo(WMDraggingInfo
*info
, WMView
*toplevel
,
352 XClientMessageEvent
*event
);
354 void W_DragDestinationStorePositionMsgInfo(WMDraggingInfo
*info
,
356 XClientMessageEvent
*event
);
358 void W_DragDestinationCancelDropOnEnter(WMView
*toplevel
, WMDraggingInfo
*info
);
360 void W_DragDestinationStateHandler(WMDraggingInfo
*info
,
361 XClientMessageEvent
*event
);
363 void W_DragDestinationInfoClear(WMDraggingInfo
*info
);
365 void W_FreeViewXdndPart(WMView
*view
);
368 /* ---[ handlers.c ]------------------------------------------------------ */
370 Bool
W_CheckIdleHandlers(void);
372 void W_CheckTimerHandlers(void);
374 Bool
W_HandleInputEvents(Bool waitForInput
, int inputfd
);
377 /* ---[ notification.c ]-------------------------------------------------- */
379 void W_InitNotificationCenter(void);
381 void W_ReleaseNotificationCenter(void);
383 void W_FlushASAPNotificationQueue(void);
385 void W_FlushIdleNotificationQueue(void);
388 /* ---[ selection.c ]----------------------------------------------------- */
390 void W_HandleSelectionEvent(XEvent
*event
);
393 /* ---[ wapplication.c ]-------------------------------------------------- */
395 typedef struct W_Application
{
396 char *applicationName
;
402 /* -- Functions -- */
404 void W_InitApplication(WMScreen
*scr
);
406 Bool
W_ApplicationInitialized(void);
409 /* ---[ wballoon.c ]------------------------------------------------------ */
411 struct W_Balloon
*W_CreateBalloon(WMScreen
*scr
);
413 void W_BalloonHandleEnterView(WMView
*view
);
415 void W_BalloonHandleLeaveView(WMView
*view
);
418 /* ---[ wcolor.c ]-------------------------------------------------------- */
421 struct W_Screen
*screen
;
424 unsigned short alpha
;
428 unsigned int exact
:1;
432 #define W_PIXEL(c) (c)->color.pixel
435 /* ---[ wevent.c ]-------------------------------------------------------- */
437 typedef struct W_EventHandler
{
438 unsigned long eventMask
;
445 /* -- Functions -- */
447 void W_CallDestroyHandlers(W_View
*view
);
450 /* ---[ wfont.c ]--------------------------------------------------------- */
452 typedef struct W_Font
{
453 struct W_Screen
*screen
;
455 struct _XftFont
*font
;
467 #define W_FONTID(f) (f)->font->fid
470 /* ---[ widgets.c ]------------------------------------------------------- */
472 #define WC_UserWidget 128
474 #define CHECK_CLASS(widget, class) assert(W_CLASS(widget)==(class))
476 #define W_CLASS(widget) (((W_WidgetType*)(widget))->widgetClass)
477 #define W_VIEW(widget) (((W_WidgetType*)(widget))->view)
479 /* -- Functions -- */
481 W_Class
W_RegisterUserWidget(void);
484 /* ---[ winputmethod.c ]-------------------------------------------------- */
486 void W_InitIM(WMScreen
*scr
);
488 void W_CreateIC(WMView
*view
);
490 void W_DestroyIC(WMView
*view
);
492 void W_FocusIC(WMView
*view
);
494 void W_UnFocusIC(WMView
*view
);
496 void W_SetPreeditPositon(W_View
*view
, int x
, int y
);
498 int W_LookupString(W_View
*view
, XKeyPressedEvent
*event
, char *buffer
,
499 int buflen
, KeySym
*keysym
, Status
*status
);
502 /* ---[ wmisc.c ]--------------------------------------------------------- */
504 void W_DrawRelief(W_Screen
*scr
, Drawable d
, int x
, int y
, unsigned int width
,
505 unsigned int height
, WMReliefType relief
);
507 void W_DrawReliefWithGC(W_Screen
*scr
, Drawable d
, int x
, int y
,
508 unsigned int width
, unsigned int height
,
510 GC black
, GC dark
, GC light
, GC white
);
512 void W_PaintTextAndImage(W_View
*view
, int wrap
, WMColor
*textColor
,
513 W_Font
*font
, WMReliefType relief
, const char *text
,
514 WMAlignment alignment
, W_Pixmap
*image
,
515 WMImagePosition position
, WMColor
*backColor
, int ofs
);
517 void W_PaintText(W_View
*view
, Drawable d
, WMFont
*font
, int x
, int y
,
518 int width
, WMAlignment alignment
, WMColor
*color
,
519 int wrap
, const char *text
, int length
);
521 int W_GetTextHeight(WMFont
*font
, const char *text
, int width
, int wrap
);
524 /* ---[ wpixmap.c ]------------------------------------------------------- */
527 struct W_Screen
*screen
;
530 unsigned short width
;
531 unsigned short height
;
537 /* ---[ wview.c ]--------------------------------------------------------- */
539 typedef struct W_ViewDelegate
{
541 void (*didMove
)(struct W_ViewDelegate
*, WMView
*);
542 void (*didResize
)(struct W_ViewDelegate
*, WMView
*);
543 void (*willMove
)(struct W_ViewDelegate
*, WMView
*, int*, int*);
544 void (*willResize
)(struct W_ViewDelegate
*, WMView
*,
545 unsigned int*, unsigned int*);
549 struct W_Screen
*screen
;
551 WMWidget
*self
; /* must point to the widget the view belongs to */
553 W_ViewDelegate
*delegate
;
566 struct W_View
*nextFocusChain
; /* next/prev in focus chain */
567 struct W_View
*prevFocusChain
;
569 struct W_View
*nextResponder
; /* next to receive keyboard events */
571 struct W_View
*parent
; /* parent WMView */
573 struct W_View
*childrenList
; /* first in list of child windows */
575 struct W_View
*nextSister
; /* next on parent's children list */
577 WMArray
*eventHandlers
; /* event handlers for this window */
579 unsigned long attribFlags
;
580 XSetWindowAttributes attribs
;
582 void *hangedData
; /* data holder for user program */
590 Atom
*droppableTypes
;
591 struct W_DragSourceProcs
*dragSourceProcs
;
592 struct W_DragDestinationProcs
*dragDestinationProcs
;
599 unsigned int realized
:1;
600 unsigned int mapped
:1;
601 unsigned int parentDying
:1;
602 unsigned int dying
:1; /* the view is being destroyed */
603 unsigned int topLevel
:1; /* is a top level window */
604 unsigned int root
:1; /* is the root window */
605 unsigned int mapWhenRealized
:1; /* map the view when it's realized */
606 unsigned int alreadyDead
:1; /* view was freed */
608 unsigned int dontCompressMotion
:1; /* motion notify event compress */
609 unsigned int notifySizeChanged
:1;
610 unsigned int dontCompressExpose
:1; /* expose event compress */
613 unsigned int worksWhenModal
:1;
614 unsigned int pendingRelease1
:1;
615 unsigned int pendingRelease2
:1;
616 unsigned int pendingRelease3
:1;
617 unsigned int pendingRelease4
:1;
618 unsigned int pendingRelease5
:1;
619 unsigned int xdndHintSet
:1;
625 #define W_VIEW_REALIZED(view) (view)->flags.realized
626 #define W_VIEW_MAPPED(view) (view)->flags.mapped
628 #define W_VIEW_DISPLAY(view) (view)->screen->display
629 #define W_VIEW_SCREEN(view) (view)->screen
630 #define W_VIEW_DRAWABLE(view) (view)->window
632 #define W_VIEW_WIDTH(view) (view)->size.width
633 #define W_VIEW_HEIGHT(view) (view)->size.height
635 /* -- Functions -- */
637 W_View
*W_GetViewForXWindow(Display
*display
, Window window
);
639 W_View
*W_CreateView(W_View
*parent
);
641 W_View
*W_CreateTopView(W_Screen
*screen
);
643 W_View
*W_CreateUnmanagedTopView(W_Screen
*screen
);
645 W_View
*W_CreateRootView(W_Screen
*screen
);
647 void W_DestroyView(W_View
*view
);
649 void W_RealizeView(W_View
*view
);
651 void W_RedisplayView(WMView
*view
);
653 void W_ReparentView(W_View
*view
, W_View
*newParent
, int x
, int y
);
655 void W_RaiseView(W_View
*view
);
657 void W_LowerView(W_View
*view
);
659 void W_MapView(W_View
*view
);
661 void W_MapSubviews(W_View
*view
);
663 void W_UnmapSubviews(W_View
*view
);
665 W_View
*W_TopLevelOfView(W_View
*view
);
667 void W_UnmapView(W_View
*view
);
669 WMView
*W_RetainView(WMView
*view
);
671 void W_ReleaseView(WMView
*view
);
673 void W_MoveView(W_View
*view
, int x
, int y
);
675 void W_ResizeView(W_View
*view
, unsigned int width
, unsigned int height
);
677 void W_SetViewBackgroundColor(W_View
*view
, WMColor
*color
);
679 void W_SetViewBackgroundPixmap(W_View
*view
, WMPixmap
*pix
);
681 void W_SetViewCursor(W_View
*view
, Cursor cursor
);
683 void W_SetFocusOfTopLevel(W_View
*toplevel
, W_View
*view
);
685 W_View
*W_FocusedViewOfToplevel(W_View
*view
);
687 void W_BroadcastMessage(W_View
*targetParent
, XEvent
*event
);
689 void W_DispatchMessage(W_View
*target
, XEvent
*event
);
694 #endif /* __cplusplus */
696 #endif /* _WINGSP_H_ */