X11Ctrl.cpp

IƱaki Zabala, 11/16/2014 04:46 PM

Download (2.09 KB)

 
1
#include "CtrlCore.h"
2

    
3
#ifdef GUI_X11
4

    
5
NAMESPACE_UPP
6

    
7
void Ctrl::GuiPlatformConstruct()
8
{
9
}
10

    
11
void Ctrl::GuiPlatformDestruct()
12
{
13
}
14

    
15
void Ctrl::GuiPlatformRemove()
16
{
17
        if(popupgrab) {
18
                EndPopupGrab();
19
                popupgrab = false;
20
        }
21
}
22

    
23
void Ctrl::GuiPlatformGetTopRect(Rect& r) const
24
{
25
}
26

    
27
String Ctrl::Name() const {
28
        return Name0();
29
}
30

    
31
bool Ctrl::GuiPlatformRefreshFrameSpecial(const Rect&)
32
{
33
        return false;
34
}
35

    
36

    
37
bool Ctrl::GuiPlatformSetFullRefreshSpecial()
38
{
39
        return false;
40
}
41

    
42
void Ctrl::GuiPlatformSelection(PasteClip& d)
43
{
44
        d.fmt.Clear();
45
        d.type = 2;
46
}
47

    
48
void GuiPlatformAdjustDragImage(ImageBuffer& b)
49
{
50
        if(Ctrl::IsCompositedGui()) {
51
                Image h = Rescale(b, 64, 64);
52
                b = h;
53
        }
54
}
55

    
56
bool GuiPlatformHasSizeGrip()
57
{
58
        return _NET_Supported().Find(XAtom("_NET_WM_MOVERESIZE")) >= 0;
59
}
60

    
61
void GuiPlatformGripResize(TopWindow *q)
62
{
63
        if(_NET_Supported().Find(XAtom("_NET_WM_MOVERESIZE")) >= 0) {
64
                XUngrabPointer(Xdisplay, CurrentTime); // 2008-02-25 cxl/mdelfe... compiz fix... who has grabbed it anyway?...
65
                XClientMessageEvent m;
66
                m.type = ClientMessage;
67
                m.serial = 0;
68
                m.send_event = XTrue;
69
                m.window = q->GetWindow();
70
                m.message_type = XAtom("_NET_WM_MOVERESIZE");
71
                m.format = 32;
72
                Point p = GetMousePos();
73
                m.data.l[0] = p.x;
74
                m.data.l[1] = p.y;
75
                m.data.l[2] = 4;
76
                m.data.l[3] = 0;
77
                m.data.l[4] = 0;
78
                XSendEvent(Xdisplay, Xroot, 0, SubstructureNotifyMask|SubstructureRedirectMask,
79
                           (XEvent*)&m);
80
        }
81
}
82

    
83
Color GuiPlatformGetScreenPixel(int x, int y)
84
{
85
        // TODO
86
        return Black;
87
}
88

    
89
void GuiPlatformAfterMenuPopUp()
90
{
91
        XSync(Xdisplay, false);
92
        Ctrl::ProcessEvents();
93
}
94

    
95
void Ctrl::PaintCaret(SystemDraw& w)
96
{
97
        GuiLock __;
98
        if(this == caretCtrl && WndCaretVisible)
99
                w.DrawRect(caretx, carety, caretcx, caretcy, InvertColor);
100
}
101

    
102
void Ctrl::SetCaret(int x, int y, int cx, int cy)
103
{
104
        GuiLock __;
105
        if(this == caretCtrl)
106
                RefreshCaret();
107
        caretx = x;
108
        carety = y;
109
        caretcx = cx;
110
        caretcy = cy;
111
        WndCaretTime = GetTickCount();
112
        if(this == caretCtrl)
113
                RefreshCaret();
114
}
115

    
116
void Ctrl::SyncCaret() {
117
        GuiLock __;
118
        if(focusCtrl != caretCtrl) {
119
                RefreshCaret();
120
                caretCtrl = focusCtrl;
121
                RefreshCaret();
122
        }
123
}
124

    
125
END_UPP_NAMESPACE
126

    
127
#endif