summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Window_Driver.H2
-rw-r--r--FL/mac.H2
-rw-r--r--FL/win32.H4
-rw-r--r--src/Fl.cxx58
-rw-r--r--src/Fl_Window.cxx40
-rw-r--r--src/Fl_cocoa.mm22
-rw-r--r--src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H2
-rw-r--r--src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx12
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H2
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx10
11 files changed, 83 insertions, 73 deletions
diff --git a/FL/Fl_Window_Driver.H b/FL/Fl_Window_Driver.H
index f386e04f4..6ff2a1bab 100644
--- a/FL/Fl_Window_Driver.H
+++ b/FL/Fl_Window_Driver.H
@@ -85,6 +85,8 @@ public:
virtual void resize(int X,int Y,int W,int H) {}
virtual void hide() {}
int hide_common();
+ virtual void map() {}
+ virtual void unmap() {}
// --- window shape stuff
void shape_pixmap_(Fl_Image* pixmap); // TODO: check
diff --git a/FL/mac.H b/FL/mac.H
index a909a294d..0128d1157 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -177,8 +177,6 @@ public:
static void GLcontext_makecurrent(NSOpenGLContext*);
static void GL_cleardrawable(void);
void destroy(void);
- void map(void);
- void unmap(void);
void collapse(void);
WindowRef window_ref(void); // useless with cocoa GL windows
void set_key_window(void);
diff --git a/FL/win32.H b/FL/win32.H
index bb8c4050a..f78e63bcc 100644
--- a/FL/win32.H
+++ b/FL/win32.H
@@ -57,10 +57,6 @@ inline void XClipBox(Fl_Region r,XRectangle* rect) {
rect->width=win_rect.right-win_rect.left;
rect->height=win_rect.bottom-win_rect.top;
}
-#define XDestroyWindow(a,b) DestroyWindow(b)
-#define XMapWindow(a,b) ShowWindow(b, SW_RESTORE)
-#define XUnmapWindow(a,b) ShowWindow(b, SW_HIDE)
-
// this object contains all win32-specific stuff about a window:
// Warning: this object is highly subject to change!
class FL_EXPORT Fl_X {
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 11d0c62ce..ffee65687 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -1451,64 +1451,6 @@ int Fl::handle_(int e, Fl_Window* window)
}
-// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
-// or any parent changes. We must correctly map/unmap the system's window.
-
-// For top-level windows it is assumed the window has already been
-// mapped or unmapped!!! This is because this should only happen when
-// Fl_Window::show() or Fl_Window::hide() is called, or in response to
-// iconize/deiconize events from the system.
-
-int Fl_Window::handle(int ev)
-{
- if (parent()) {
- switch (ev) {
- case FL_SHOW:
- if (!shown()) show();
- else {
-#if defined(USE_X11) || defined(WIN32)
- XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
-#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window mapping
- i->map();
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: code to show a window on screen"
-#else
-# error unsupported platform
-#endif // __APPLE__ // PORTME: Fl_Window_Driver - platform window mapping
- }
- break;
- case FL_HIDE:
- if (shown()) {
- // Find what really turned invisible, if it was a parent window
- // we do nothing. We need to avoid unnecessary unmap calls
- // because they cause the display to blink when the parent is
- // remapped. However if this or any intermediate non-window
- // widget has really had hide() called directly on it, we must
- // unmap because when the parent window is remapped we don't
- // want to reappear.
- if (visible()) {
- Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
- if (p->type() >= FL_WINDOW) break; // don't do the unmap
- }
-#if defined(USE_X11) || defined(WIN32)
- XUnmapWindow(fl_display, fl_xid(this));
-#elif defined(__APPLE_QUARTZ__) // PORTME: Fl_Window_Driver - platform window unmapping, again
- i->unmap();
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: code to hide a window from screen"
-#else
-# error platform unsupported
-#endif
- }
- break;
- }
-// } else if (ev == FL_FOCUS || ev == FL_UNFOCUS) {
-// Fl_Tooltip::exit(Fl_Tooltip::current());
- }
-
- return Fl_Group::handle(ev);
-}
-
////////////////////////////////////////////////////////////////
// Back compatibility cut & paste functions for fltk 1.1 only:
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx
index df6f97259..8cf091427 100644
--- a/src/Fl_Window.cxx
+++ b/src/Fl_Window.cxx
@@ -514,6 +514,46 @@ void Fl_Window::hide() {
pWindowDriver->hide();
}
+
+// FL_SHOW and FL_HIDE are called whenever the visibility of this widget
+// or any parent changes. We must correctly map/unmap the system's window.
+
+// For top-level windows it is assumed the window has already been
+// mapped or unmapped!!! This is because this should only happen when
+// Fl_Window::show() or Fl_Window::hide() is called, or in response to
+// iconize/deiconize events from the system.
+int Fl_Window::handle(int ev)
+{
+ if (parent()) {
+ switch (ev) {
+ case FL_SHOW:
+ if (!shown()) show();
+ else {
+ pWindowDriver->map();
+ }
+ break;
+ case FL_HIDE:
+ if (shown()) {
+ // Find what really turned invisible, if it was a parent window
+ // we do nothing. We need to avoid unnecessary unmap calls
+ // because they cause the display to blink when the parent is
+ // remapped. However if this or any intermediate non-window
+ // widget has really had hide() called directly on it, we must
+ // unmap because when the parent window is remapped we don't
+ // want to reappear.
+ if (visible()) {
+ Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
+ if (p->type() >= FL_WINDOW) break; // don't do the unmap
+ }
+ pWindowDriver->unmap();
+ }
+ break;
+ }
+ }
+
+ return Fl_Group::handle(ev);
+}
+
//
// End of "$Id$".
//
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 68d1631d1..35239835e 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3528,24 +3528,30 @@ void Fl_X::destroy() {
delete subRect();
}
-void Fl_X::map() {
- if (w && xid && ![xid parentWindow]) { // 10.2
+
+void Fl_Cocoa_Window_Driver::map() {
+ Window xid = fl_xid(pWindow);
+ if (pWindow && xid && ![xid parentWindow]) { // 10.2
// after a subwindow has been unmapped, it has lost its parent window and its frame may be wrong
[xid setSubwindowFrame];
}
- if (cursor) {
- [(NSCursor*)cursor release];
- cursor = NULL;
+ Fl_X *i = Fl_X::i(pWindow);
+ if (i->cursor) {
+ [(NSCursor*)i->cursor release];
+ i->cursor = NULL;
}
}
-void Fl_X::unmap() {
- if (w && xid) {
- if (w->parent()) [[xid parentWindow] removeChildWindow:xid]; // necessary with at least 10.5
+
+void Fl_Cocoa_Window_Driver::unmap() {
+ Window xid = fl_xid(pWindow);
+ if (pWindow && xid) {
+ if (pWindow->parent()) [[xid parentWindow] removeChildWindow:xid]; // necessary with at least 10.5
[xid orderOut:nil];
}
}
+
// intersects current and x,y,w,h rectangle and returns result as a new Fl_Region
Fl_Region Fl_X::intersect_region_and_rect(Fl_Region current, int x,int y,int w, int h)
{
diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
index bd5a0e79e..07a6dd8a3 100644
--- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
+++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H
@@ -78,6 +78,8 @@ public:
virtual void show();
virtual void resize(int X,int Y,int W,int H);
virtual void hide();
+ virtual void map();
+ virtual void unmap();
virtual void shape(const Fl_Image* img);
// that one is implemented in Fl_Cocoa.mm because it uses Objective-c
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
index 4d7d8b490..27fb5bc7e 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H
@@ -83,6 +83,8 @@ public:
virtual void label(const char *name,const char *iname);
virtual void resize(int X,int Y,int W,int H);
virtual void hide();
+ virtual void map();
+ virtual void unmap();
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);
diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
index 70c254216..a14430af9 100644
--- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
+++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx
@@ -504,7 +504,7 @@ void Fl_WinAPI_Window_Driver::hide() {
ShowWindow(ip->xid, SW_HIDE);
ShowWindow(p, SW_SHOWNA);
}
- XDestroyWindow(fl_display, ip->xid);
+ DestroyWindow(ip->xid);
// end of fix for STR#3079
if (count) {
int ii;
@@ -521,6 +521,16 @@ void Fl_WinAPI_Window_Driver::hide() {
delete ip;
}
+
+void Fl_WinAPI_Window_Driver::map() {
+ ShowWindow(fl_xid(pWindow), SW_RESTORE); // extra map calls are harmless
+}
+
+
+void Fl_WinAPI_Window_Driver::unmap() {
+ ShowWindow(fl_xid(pWindow), SW_HIDE);
+}
+
//
// End of "$Id$".
//
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index 967b7d0fa..b2582a57b 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -92,6 +92,8 @@ public:
virtual void label(const char *name, const char *mininame);
virtual void destroy_double_buffer();
virtual void hide();
+ virtual void map();
+ virtual void unmap();
virtual void shape(const Fl_Image* img);
virtual void icons(const Fl_RGB_Image *icons[], int count);
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx
index 4f04dba7f..59313cc42 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -475,6 +475,16 @@ void Fl_X11_Window_Driver::hide() {
delete ip;
}
+
+void Fl_X11_Window_Driver::map() {
+ XMapWindow(fl_display, fl_xid(pWindow)); // extra map calls are harmless
+}
+
+
+void Fl_X11_Window_Driver::unmap() {
+ XUnmapWindow(fl_display, fl_xid(pWindow));
+}
+
//
// End of "$Id$".
//