diff options
Diffstat (limited to 'test/fullscreen.cxx')
| -rw-r--r-- | test/fullscreen.cxx | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/test/fullscreen.cxx b/test/fullscreen.cxx index c9e4b2908..724ec82f0 100644 --- a/test/fullscreen.cxx +++ b/test/fullscreen.cxx @@ -127,7 +127,7 @@ class fullscreen_window : public Fl_Single_Window { fullscreen_window(int W, int H, const char *t=0); int handle (int e); Fl_Toggle_Light_Button *b3; - + Fl_Toggle_Light_Button *b4; }; fullscreen_window::fullscreen_window(int W, int H, const char *t) : Fl_Single_Window(W, H, t) { @@ -170,27 +170,63 @@ void border_cb(Fl_Widget *o, void *p) { #endif } -int px,py,pw,ph; Fl_Button *border_button; void fullscreen_cb(Fl_Widget *o, void *p) { Fl_Window *w = (Fl_Window *)p; int d = ((Fl_Button *)o)->value(); if (d) { - px = w->x(); - py = w->y(); - pw = w->w(); - ph = w->h(); w->fullscreen(); - w->override(); #ifndef WIN32 // update our border state in case border was turned off border_button->value(w->border()); #endif } else { - //w->fullscreen_off(px,py,pw,ph); w->fullscreen_off(); } } +void allscreens_cb(Fl_Widget *o, void *p) { + Fl_Window *w = (Fl_Window *)p; + int d = ((Fl_Button *)o)->value(); + if (d) { + int top, bottom, left, right; + int top_y, bottom_y, left_x, right_x; + + int sx, sy, sw, sh; + + top = bottom = left = right = 0; + + Fl::screen_xywh(sx, sy, sw, sh, 0); + top_y = sy; + bottom_y = sy + sh; + left_x = sx; + right_x = sx + sw; + + for (int i = 1;i < Fl::screen_count();i++) { + Fl::screen_xywh(sx, sy, sw, sh, i); + if (sy < top_y) { + top = i; + top_y = sy; + } + if ((sy + sh) > bottom_y) { + bottom = i; + bottom_y = sy + sh; + } + if (sx < left_x) { + left = i; + left_x = sx; + } + if ((sx + sw) > right_x) { + right = i; + right_x = sx + sw; + } + } + + w->fullscreen_screens(top, bottom, left, right); + } else { + w->fullscreen_screens(-1, -1, -1, -1); + } +} + void update_screeninfo(Fl_Widget *b, void *p) { Fl_Browser *browser = (Fl_Browser *)p; int x, y, w, h; @@ -219,7 +255,7 @@ void exit_cb(Fl_Widget *, void *) { exit(0); } -#define NUMB 7 +#define NUMB 8 int twowindow = 0; int initfull = 0; @@ -284,6 +320,10 @@ int main(int argc, char **argv) { window.b3->callback(fullscreen_cb,w); y+=30; + window.b4 = new Fl_Toggle_Light_Button(50,y,window.w()-60,30,"All Screens"); + window.b4->callback(allscreens_cb,w); + y+=30; + Fl_Button eb(50,y,window.w()-60,30,"Exit"); eb.callback(exit_cb); y+=30; |
