summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-03-23 20:42:13 +0000
committerManolo Gouy <Manolo>2016-03-23 20:42:13 +0000
commitabc12cd376a615af7182b81a435fa2ccb63e4e5d (patch)
tree58f898451ade103a102e0b7a712e1a1f85490b24 /src
parentd3b33cdaeaa17d5ee1f7208d467fd2edbb617c16 (diff)
Rewrite Fl_Window::show(int argc, char **argv) under the driver model.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_arg.cxx45
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.H2
-rw-r--r--src/drivers/X11/Fl_X11_Window_Driver.cxx37
3 files changed, 42 insertions, 42 deletions
diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx
index 34ba95bb1..8f92e3fed 100644
--- a/src/Fl_arg.cxx
+++ b/src/Fl_arg.cxx
@@ -20,8 +20,8 @@
// You do not need to call this! Feel free to make up your own switches.
#include <FL/Fl.H>
-#include <FL/x.H>
#include <FL/Fl_Window.H>
+#include <FL/Fl_Window_Driver.H>
#include <FL/Fl_Tooltip.H>
#include <FL/filename.H>
#include <FL/fl_draw.H>
@@ -301,32 +301,7 @@ void Fl_Window::show(int argc, char **argv) {
Fl::get_system_colors();
-#if defined(WIN32)
-#elif defined(__APPLE__) // PORTME: Fl_Screen_Driver- platform default parameters
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: Parse additional default settings"
-#else // X11
- // Get defaults for drag-n-drop and focus...
- const char *key = 0, *val;
-
- if (Fl::first_window()) key = Fl::first_window()->xclass();
- if (!key) key = "fltk";
-
- val = XGetDefault(fl_display, key, "dndTextOps");
- if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);
-
- val = XGetDefault(fl_display, key, "tooltips");
- if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);
-
- val = XGetDefault(fl_display, key, "visibleFocus");
- if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);
-#endif // !WIN32 && !__APPLE__ // PORTME: platform defaults
+ pWindowDriver->show_with_args_begin();
// set colors first, so background_pixel is correct:
static char beenhere;
@@ -365,21 +340,7 @@ void Fl_Window::show(int argc, char **argv) {
// Show the window AFTER we have set the colors and scheme.
show();
-#if defined(WIN32)
-#elif defined(__APPLE__) // PORTME: Fl_System_Driver - platform properties
-#elif defined(FL_PORTING)
-# pragma message "FL_PORTING: Parse additional default settings"
-#else // X11
- // set the command string, used by state-saving window managers:
- int j;
- int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
- char *buffer = new char[n];
- char *p = buffer;
- for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
- XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0,
- (unsigned char *)buffer, p-buffer-1);
- delete[] buffer;
-#endif // !WIN32 && !__APPLE__ // PORTME: Fl_System_Driver - platform properties
+ pWindowDriver->show_with_args_end(argc, argv);
}
// Calls useful for simple demo programs, with automatic help message:
diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H
index de2d65446..000ee1548 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.H
+++ b/src/drivers/X11/Fl_X11_Window_Driver.H
@@ -100,6 +100,8 @@ public:
virtual void size_range();
virtual void iconize();
virtual void decoration_sizes(int *top, int *left, int *right, int *bottom);
+ virtual void show_with_args_begin();
+ virtual void show_with_args_end(int argc, char **argv);
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 7ae170284..dbfee0371 100644
--- a/src/drivers/X11/Fl_X11_Window_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx
@@ -24,6 +24,7 @@
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_Overlay_Window.H>
#include <FL/Fl_Menu_Window.H>
+#include <FL/Fl_Tooltip.H>
#include <FL/fl_draw.H>
#include <FL/fl_ask.H>
#include <FL/Fl.H>
@@ -517,6 +518,42 @@ void Fl_X11_Window_Driver::decoration_sizes(int *top, int *left, int *right, in
*bottom = 8;
}
+void Fl_X11_Window_Driver::show_with_args_begin() {
+ // Get defaults for drag-n-drop and focus...
+ const char *key = 0, *val;
+
+ if (Fl::first_window()) key = Fl::first_window()->xclass();
+ if (!key) key = "fltk";
+
+ val = XGetDefault(fl_display, key, "dndTextOps");
+ if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
+ strcasecmp(val, "on") == 0 ||
+ strcasecmp(val, "yes") == 0);
+
+ val = XGetDefault(fl_display, key, "tooltips");
+ if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
+ strcasecmp(val, "on") == 0 ||
+ strcasecmp(val, "yes") == 0);
+
+ val = XGetDefault(fl_display, key, "visibleFocus");
+ if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
+ strcasecmp(val, "on") == 0 ||
+ strcasecmp(val, "yes") == 0);
+}
+
+
+void Fl_X11_Window_Driver::show_with_args_end(int argc, char **argv) {
+ // set the command string, used by state-saving window managers:
+ int j;
+ int n=0; for (j=0; j<argc; j++) n += strlen(argv[j])+1;
+ char *buffer = new char[n];
+ char *p = buffer;
+ for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
+ XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
+ (unsigned char *)buffer, p-buffer-1);
+ delete[] buffer;
+}
+
//
// End of "$Id$".
//