1 #ifndef XLIBWINDOW_H
2 #define XLIBWINDOW_H
3 
4 #include <cairo.h>
5 #include <X11/Xlib.h>
6 
7 #include "module/x11/x11stuff.h"
8 
9 struct _FcitxClassicUI;
10 
11 typedef struct _FcitxXlibWindow FcitxXlibWindow;
12 typedef void (*FcitxMoveWindowFunc)(FcitxXlibWindow* window);
13 typedef void (*FcitxPaintContentFunc)(FcitxXlibWindow* window, cairo_t* c);
14 typedef void (*FcitxCalculateContentSizeFunc)(FcitxXlibWindow* window, unsigned int* contentWidth, unsigned int* contentHeight);
15 
16 struct _FcitxXlibWindow {
17     Window wId;
18     struct _FcitxWindowBackground* background;
19     unsigned int width, height;
20 
21     cairo_surface_t *xlibSurface;
22     cairo_surface_t *contentSurface;
23     cairo_surface_t *backgroundSurface;
24 
25     struct _FcitxClassicUI *owner;
26     FcitxMoveWindowFunc MoveWindow;
27     FcitxCalculateContentSizeFunc CalculateContentSize;
28     FcitxPaintContentFunc paintContent;
29     unsigned int oldContentWidth;
30     unsigned int oldContentHeight;
31     int contentX;
32     int contentY;
33     unsigned int contentHeight;
34     unsigned int contentWidth;
35     unsigned int epoch;
36 };
37 
38 void* FcitxXlibWindowCreate(struct _FcitxClassicUI* classicui, size_t size);
39 void FcitxXlibWindowInit(FcitxXlibWindow* window,
40                          uint width, uint height,
41                          int x, int y,
42                          char* name,
43                          FcitxXWindowType windowType,
44                          struct _FcitxWindowBackground* background,
45                          long int inputMask,
46                          FcitxMoveWindowFunc moveWindow,
47                          FcitxCalculateContentSizeFunc calculateContentSize,
48                          FcitxPaintContentFunc paintContent
49                         );
50 void FcitxXlibWindowDestroy(FcitxXlibWindow* window);
51 void FcitxXlibWindowPaint(FcitxXlibWindow* window);
52 
53 #endif // XLIBWINDOW_H
54