From 2e381aa4c6afbe4c8d4dbce83f5593147ce13249 Mon Sep 17 00:00:00 2001 From: cxl Date: Tue, 7 Jun 2016 12:48:12 +0000 Subject: [PATCH] CtrlLib: Fixed to compile in Posix git-svn-id: svn://ultimatepp.org/upp/trunk@9907 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CtrlCore/GtkCtrl.h | 18 +++++++++--------- uppsrc/CtrlCore/GtkEvent.cpp | 28 ++++++++++++++-------------- uppsrc/CtrlCore/GtkWnd.cpp | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/uppsrc/CtrlCore/GtkCtrl.h b/uppsrc/CtrlCore/GtkCtrl.h index 3ce307c37..c2fc87b36 100644 --- a/uppsrc/CtrlCore/GtkCtrl.h +++ b/uppsrc/CtrlCore/GtkCtrl.h @@ -32,7 +32,7 @@ _DBG_ EVENT_TEXT, }; - struct Event0 { + struct GEvent0 { int time; int windowid; int type; @@ -42,16 +42,16 @@ _DBG_ int count; }; - struct Event : Moveable { + struct GEvent : Moveable { GdkEvent *event; void Free(); - void Set(const Event& e); - Event(const Event& e); - void operator=(const Event& e); + void Set(const GEvent& e); + GEvent(const GEvent& e); + void operator=(const GEvent& e); - Event(); - ~Event(); + GEvent(); + ~GEvent(); }; struct Win : Moveable { @@ -65,7 +65,7 @@ _DBG_ bool SweepConfigure(bool wait); bool SweepFocus(bool wait); - static BiVector Events; + static BiVector Events; static Vector< Ptr > activePopup; // created with 'activate' flag - usually menu static Vector< Ptr > visiblePopup; // any popup visible on screen static Vector wins; @@ -176,7 +176,7 @@ public: static Point CurrentMousePos; static guint CurrentState; static guint32 CurrentTime; - static Event CurrentEvent; + static GEvent CurrentEvent; GdkWindow *gdk() const { return top ? top->window->window : NULL; } GtkWindow *gtk() const { return top ? (GtkWindow *)top->window : NULL; } diff --git a/uppsrc/CtrlCore/GtkEvent.cpp b/uppsrc/CtrlCore/GtkEvent.cpp index f6ace2a4a..96cf971c3 100644 --- a/uppsrc/CtrlCore/GtkEvent.cpp +++ b/uppsrc/CtrlCore/GtkEvent.cpp @@ -7,12 +7,12 @@ NAMESPACE_UPP #define LLOG(x) // DLOG(rmsecs() << ' ' << x) //_DBG_ #define LOG_EVENTS -BiVector Ctrl::Events; +BiVector Ctrl::Events; Point Ctrl::CurrentMousePos; guint Ctrl::CurrentState; guint32 Ctrl::CurrentTime; -Ctrl::Event Ctrl::CurrentEvent; +Ctrl::GEvent Ctrl::CurrentEvent; bool GetShift() { return Ctrl::CurrentState & GDK_SHIFT_MASK; } bool GetCtrl() { return Ctrl::CurrentState & GDK_CONTROL_MASK; } @@ -194,12 +194,12 @@ int Ctrl::DoButtonEvent(GdkEvent *event, bool press) return Null; } -Ctrl::Event::Event() +Ctrl::GEvent::GEvent() { event = NULL; } -void Ctrl::Event::Free() +void Ctrl::GEvent::Free() { if(event) { gdk_event_free(event); @@ -207,23 +207,23 @@ void Ctrl::Event::Free() } } -void Ctrl::Event::Set(const Event& e) +void Ctrl::GEvent::Set(const GEvent& e) { - *(Event0 *)this = e; + *(GEvent0 *)this = e; event = e.event ? gdk_event_copy(e.event) : NULL; } -Ctrl::Event::~Event() +Ctrl::GEvent::~GEvent() { Free(); } -Ctrl::Event::Event(const Event& e) +Ctrl::GEvent::GEvent(const GEvent& e) { Set(e); } -void Ctrl::Event::operator=(const Event& e) +void Ctrl::GEvent::operator=(const GEvent& e) { if(this == &e) return; @@ -235,7 +235,7 @@ void Ctrl::AddEvent(gpointer user_data, int type, const Value& value, GdkEvent * { if(Events.GetCount() > 50000) return; - Event& e = Events.AddTail(); + GEvent& e = Events.AddTail(); e.windowid = (uint32)(uintptr_t)user_data; e.type = type; e.value = value; @@ -502,9 +502,9 @@ bool Ctrl::ProcessEvent0(bool *quit, bool fetch) ASSERT(IsMainThread()); bool r = false; if(IsWaitingEvent0(fetch)) { - while(Events.GetCount() > 1) { // Event compression (coalesce autorepeat, mouse moves/wheel, configure) - Event& a = Events[0]; - Event& b = Events[1]; + while(Events.GetCount() > 1) { // GEvent compression (coalesce autorepeat, mouse moves/wheel, configure) + GEvent& a = Events[0]; + GEvent& b = Events[1]; if(b.type == a.type && a.windowid == b.windowid && a.state == b.state) { if(a.type == GDK_KEY_PRESS && a.value == b.value) b.count += a.count; @@ -520,7 +520,7 @@ bool Ctrl::ProcessEvent0(bool *quit, bool fetch) break; FocusSync(); } - Event& e = Events.Head(); + GEvent& e = Events.Head(); CurrentTime = e.time; CurrentMousePos = e.mousepos; CurrentState = e.state; diff --git a/uppsrc/CtrlCore/GtkWnd.cpp b/uppsrc/CtrlCore/GtkWnd.cpp index c6cdfd3a4..54cfcc215 100644 --- a/uppsrc/CtrlCore/GtkWnd.cpp +++ b/uppsrc/CtrlCore/GtkWnd.cpp @@ -407,7 +407,7 @@ bool Ctrl::SweepConfigure(bool wait) bool r = false; FetchEvents(wait); for(int i = 0; i < Events.GetCount() && this_; i++) { - Event& e = Events[i]; + GEvent& e = Events[i]; if(e.type == GDK_CONFIGURE && this_ && top->id == e.windowid) { Rect rect = e.value; LLOG("SweepConfigure " << rect);