MT issues X11 fix

git-svn-id: svn://ultimatepp.org/upp/trunk@1507 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2009-08-13 16:08:34 +00:00
parent 1205935960
commit 57a34eb230
4 changed files with 228 additions and 221 deletions

View file

@ -580,8 +580,10 @@ private:
static Callback CtrlCall; static Callback CtrlCall;
static bool DoCall(); static bool DoCall();
static bool PeekMsg(MSG& msg);
#ifdef PLATFORM_WIN32
static bool PeekMsg(MSG& msg);
#endif
// System window interface... // System window interface...
void WndShow0(bool b); void WndShow0(bool b);
@ -693,8 +695,6 @@ protected:
friend void sSetCursor(Ctrl *ctrl, const Image& m); friend void sSetCursor(Ctrl *ctrl, const Image& m);
typedef Ctrl CLASSNAME;
public: public:
virtual void NcCreate(HWND hwnd); virtual void NcCreate(HWND hwnd);
virtual void NcDestroy(); virtual void NcDestroy();
@ -707,6 +707,8 @@ public:
static Ctrl *CtrlFromHWND(HWND hwnd); static Ctrl *CtrlFromHWND(HWND hwnd);
#endif #endif
typedef Ctrl CLASSNAME;
#ifdef PLATFORM_X11 #ifdef PLATFORM_X11
protected: protected:
struct XWindow { struct XWindow {

View file

@ -131,10 +131,12 @@ void Ctrl::WndDestroy()
ICall(callback(this, &Ctrl::WndDestroy0)); ICall(callback(this, &Ctrl::WndDestroy0));
} }
#ifdef PLATFORM_WIN32
void Ctrl::WndCreateCaret(const Rect& cr) void Ctrl::WndCreateCaret(const Rect& cr)
{ {
ICall(THISBACK1(WndCreateCaret0, cr)); ICall(THISBACK1(WndCreateCaret0, cr));
} }
#endif
void Ctrl::WndShow(bool b) void Ctrl::WndShow(bool b)
{ {

View file

@ -70,7 +70,7 @@ void Ctrl::DoPaint(const Vector<Rect>& invalid)
} }
} }
void Ctrl::WndScrollView(const Rect& r, int dx, int dy) void Ctrl::WndScrollView0(const Rect& r, int dx, int dy)
{ {
GuiLock __; GuiLock __;
if(r.IsEmpty() || !GetWindow()) return; if(r.IsEmpty() || !GetWindow()) return;
@ -314,9 +314,12 @@ void Ctrl::GuiSleep0(int ms)
timeout.tv_sec = ms / 1000; timeout.tv_sec = ms / 1000;
timeout.tv_usec = ms % 1000 * 1000; timeout.tv_usec = ms % 1000 * 1000;
XFlush(Xdisplay); XFlush(Xdisplay);
int level = LeaveGuiMutexAll(); do {
int level = LeaveGMutexAll();
select(Xconnection + 1, &fdset, NULL, NULL, &timeout); select(Xconnection + 1, &fdset, NULL, NULL, &timeout);
PerformCall(); EnterGMutex(level);
}
while(DoCall());
} }
static int granularity = 10; static int granularity = 10;
@ -350,9 +353,12 @@ void Ctrl::EventLoop0(Ctrl *ctrl)
timeout.tv_sec = 0; timeout.tv_sec = 0;
timeout.tv_usec = 1000 * granularity; timeout.tv_usec = 1000 * granularity;
XFlush(Xdisplay); XFlush(Xdisplay);
int level = LeaveGuiMutexAll(); do {
int level = LeaveGMutexAll();
select(Xconnection + 1, &fdset, NULL, NULL, &timeout); select(Xconnection + 1, &fdset, NULL, NULL, &timeout);
PerformCall(); EnterGMutex(level);
}
while(DoCall());
// GuiSleep()(granularity); // GuiSleep()(granularity);
SyncMousePos(); SyncMousePos();
while(IsWaitingEvent()) { while(IsWaitingEvent()) {
@ -606,7 +612,7 @@ Ctrl *Ctrl::GetOwner()
return q >= 0 ? Xwindow()[q].owner : NULL; return q >= 0 ? Xwindow()[q].owner : NULL;
} }
void Ctrl::WndShow(bool b) void Ctrl::WndShow0(bool b)
{ {
GuiLock __; GuiLock __;
LLOG("WndShow " << b); LLOG("WndShow " << b);
@ -624,7 +630,7 @@ void Ctrl::WndShow(bool b)
} }
} }
void Ctrl::WndUpdate() void Ctrl::WndUpdate0()
{ {
GuiLock __; GuiLock __;
LTIMING("WndUpdate"); LTIMING("WndUpdate");
@ -641,7 +647,7 @@ void Ctrl::WndUpdate()
} }
} }
void Ctrl::WndUpdate(const Rect& r) void Ctrl::WndUpdate0r(const Rect& r)
{ {
GuiLock __; GuiLock __;
LTIMING("WndUpdate Rect"); LTIMING("WndUpdate Rect");
@ -657,7 +663,7 @@ void Ctrl::WndUpdate(const Rect& r)
xw.invalid = Subtract(xw.invalid, r, dummy); xw.invalid = Subtract(xw.invalid, r, dummy);
} }
void Ctrl::WndSetPos(const Rect& r) void Ctrl::WndSetPos0(const Rect& r)
{ {
GuiLock __; GuiLock __;
if(!top) return; if(!top) return;
@ -798,10 +804,11 @@ void Ctrl::KillFocus(Window window)
w.ctrl->KillFocusWnd(); w.ctrl->KillFocusWnd();
} }
bool Ctrl::SetWndFocus() void Ctrl::SetWndFocus0(bool *b)
{ {
GuiLock __; GuiLock __;
LLOG("SetWndFocus " << Name()); LLOG("SetWndFocus " << Name());
*b = false;
if(top && top->window != focusWindow && IsEnabled() && IsVisible()) { if(top && top->window != focusWindow && IsEnabled() && IsVisible()) {
LLOG("Setting focus... "); LLOG("Setting focus... ");
LTIMING("XSetInfputFocus"); LTIMING("XSetInfputFocus");
@ -809,9 +816,8 @@ bool Ctrl::SetWndFocus()
XSetInputFocus(Xdisplay, top->window, RevertToParent, CurrentTime); XSetInputFocus(Xdisplay, top->window, RevertToParent, CurrentTime);
focusWindow = top->window; focusWindow = top->window;
SetFocusWnd(); SetFocusWnd();
return true; *b = true;
} }
return false;
} }
bool Ctrl::HasWndFocus() const bool Ctrl::HasWndFocus() const
@ -934,7 +940,7 @@ void Ctrl::AddGlobalRepaint()
} }
} }
void Ctrl::WndInvalidateRect(const Rect& r) void Ctrl::WndInvalidateRect0(const Rect& r)
{ {
GuiLock __; GuiLock __;
if(!top) return; if(!top) return;
@ -942,7 +948,7 @@ void Ctrl::WndInvalidateRect(const Rect& r)
Invalidate(Xwindow().Get(top->window), r); Invalidate(Xwindow().Get(top->window), r);
} }
void Ctrl::SetWndForeground() void Ctrl::SetWndForeground0()
{ {
GuiLock __; GuiLock __;
LLOG("SetWndForeground " << Name()); LLOG("SetWndForeground " << Name());
@ -967,17 +973,20 @@ bool Ctrl::IsWndForeground() const
return ~focusCtrlWnd == (q ? q : GetTopCtrl()); return ~focusCtrlWnd == (q ? q : GetTopCtrl());
} }
bool Ctrl::WndEnable(bool b) void Ctrl::WndEnable0(bool *b)
{ {
GuiLock __; GuiLock __;
LLOG("WndEnable"); LLOG("WndEnable");
if(!top) return false; if(!top) {
if(!b) { *b = false;
return;
}
if(!*b) {
ReleaseCapture(); ReleaseCapture();
if(HasWndFocus()) if(HasWndFocus())
XSetInputFocus(Xdisplay, None, RevertToPointerRoot, CurrentTime); XSetInputFocus(Xdisplay, None, RevertToPointerRoot, CurrentTime);
} }
return true; *b = true;
} }
// 01/12/2007 - mdelfede // 01/12/2007 - mdelfede

View file

@ -560,13 +560,7 @@ bool IsEmptyImage(const Image& m)
Image GtkThemeIcon(const char *name, int size) Image GtkThemeIcon(const char *name, int size)
{ {
<<<<<<< .mine
Image m = GetGTK(gtk__parent(), size, 0, name, GTK_THEMEICON, 0, 0); Image m = GetGTK(gtk__parent(), size, 0, name, GTK_THEMEICON, 0, 0);
=======
Image m = GetGTK(gtk__parent(), size ? GTK_ICON_SIZE_LARGE_TOOLBAR
: GTK_ICON_SIZE_SMALL_TOOLBAR,
0, name, GTK_THEMEICON, 0, 0);
>>>>>>> .r1505
Size sz = m.GetSize(); Size sz = m.GetSize();
int rsz = size ? 48 : 16; int rsz = size ? 48 : 16;
if(sz.cx > rsz || sz.cy > rsz) if(sz.cx > rsz || sz.cy > rsz)