Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
[STR Closed w/Resolution] Link: http://www.fltk.org/str.php?L2641 Version: 1.3-feature Fix Version: 1.3-current (r9299) Fixed in Subversion repository. Thanks for the patch Link: http://www.fltk.org/str.php?L2641 Version: 1.3-feature Fix Version: 1.3-current (r9299) ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached file "screen_xywh_xinerama.patch"... Link: http://www.fltk.org/str.php?L2641 Version: 1.4-featureIndex: src/screen_xywh.cxx === --- src/screen_xywh.cxx (revision 8863) +++ src/screen_xywh.cxx (arbetskopia) @@ -30,6 +30,7 @@ #include #include +#define MAX_SCREENS 16 // Number of screens returned by multi monitor aware API; -1 before init static int num_screens = -1; @@ -96,7 +97,7 @@ if (fl_edm) { // We do have EnumDisplayMonitors, so lets find out how many monitors... - num_screens = GetSystemMetrics(SM_CMONITORS); + //num_screens = GetSystemMetrics(SM_CMONITORS); // if (num_screens > 1) { // If there is more than 1 monitor, enumerate them... @@ -142,47 +143,62 @@ } num_screens = count; } -#elif HAVE_XINERAMA +#else + +#if HAVE_XINERAMA # include +#endif +typedef struct { + short x_org; + short y_org; + short width; + short height; +} FLScreenInfo; +static FLScreenInfo screens[MAX_SCREENS]; +static float dpi[MAX_SCREENS][2]; -// Screen data... -static XineramaScreenInfo *screens; -static float dpi[16][2]; - static void screen_init() { if (!fl_display) fl_open_display(); + // FIXME: Rewrite using randr instead +#if HAVE_XINERAMA if (XineramaIsActive(fl_display)) { -screens = XineramaQueryScreens(fl_display, &num_screens); -int i; -// Xlib and Xinerama may disagree on the screen count. Sigh... -// Use the minimum of the reported counts. -// Use the previous screen's info for non-existent ones. -int sc = ScreenCount(fl_display); // Xlib screen count -for (i=0; i 0) ? dpi[i-1][0] : 0.0f; - mm = (i < sc) ? DisplayHeightMM(fl_display, i) : 0; - dpi[i][1] = mm ? screens[i].height*25.4f/mm : (i > 0) ? dpi[i-1][1] : 0.0f; +static XineramaScreenInfo *xsi = XineramaQueryScreens(fl_display, &num_screens); +if (num_screens > MAX_SCREENS) num_screens = MAX_SCREENS; + +/* There's no way to use different DPI for different Xinerama + screens. */ +for (int i=0; i MAX_SCREENS) num_screens = MAX_SCREENS; + +for (int i=0; i 0 && screens) { + if (num_screens > 0) { X = screens[n].x_org; Y = screens[n].y_org; W = screens[n].width; H = screens[n].height; - } else -#endif // HAVE_XINERAMA - { -/* Fallback if something is broken (or no Xinerama)... */ -X = 0; -Y = 0; -W = DisplayWidth(fl_display, fl_screen); -H = DisplayHeight(fl_display, fl_screen); } #endif // WIN32 } @@ -333,16 +340,11 @@ h = dpi_h[n]; v = dpi_v[n]; } -#elif HAVE_XINERAMA +#else if (n >= 0 && n < num_screens) { h = dpi[n][0]; v = dpi[n][1]; } -#else - if (n >= 0 && n < num_screens) { -h = dpi[0]; -v = dpi[1]; - } #endif // WIN32 } ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Posted updated fullscreen patch. Fixes collisions of status bits, and deals better with windows coords, fix for windows starting in fullscreen. Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached file "fltk-1.3.x-fullscreen.patch"... Link: http://www.fltk.org/str.php?L2641 Version: 1.4-featurediff -bur fltk-1.3.x-r8732.org/documentation/src/enumerations.dox fltk-1.3.x-r8732/documentation/src/enumerations.dox --- fltk-1.3.x-r8732.org/documentation/src/enumerations.dox 2011-05-11 17:49:30.0 +0200 +++ fltk-1.3.x-r8732/documentation/src/enumerations.dox 2011-05-26 10:15:39.258959203 +0200 @@ -57,6 +57,7 @@ \li FL_DND_LEAVE - The mouse pointer left a widget still dragging data. \li FL_DND_RELEASE - Dragged data is about to be dropped. +\li FL_FULLSCREEN - The fullscreen state of the window has changed. \section enumerations_when Callback "When" Conditions diff -bur fltk-1.3.x-r8732.org/documentation/src/events.dox fltk-1.3.x-r8732/documentation/src/events.dox --- fltk-1.3.x-r8732.org/documentation/src/events.dox 2011-05-11 17:49:30.0 +0200 +++ fltk-1.3.x-r8732/documentation/src/events.dox 2011-05-26 10:15:39.259959029 +0200 @@ -300,6 +300,13 @@ the widget. If the widget returns 1, it will receive the data in the immediately following \p FL_PASTE event. +\subsection events_fl_fullscreen FL_FULLSCREEN + +The application window has been changed from normal to fullscreen, or +from fullscreen to normal. If you are using a X window manager which +supports Extended Window Manager Hints, this event will not be +delivered until the change has actually happened. + \section events_event_xxx Fl::event_*() methods diff -bur fltk-1.3.x-r8732.org/FL/Enumerations.H fltk-1.3.x-r8732/FL/Enumerations.H --- fltk-1.3.x-r8732.org/FL/Enumerations.H 2011-05-21 23:55:59.0 +0200 +++ fltk-1.3.x-r8732/FL/Enumerations.H 2011-05-26 10:15:39.256959549 +0200 @@ -292,7 +292,12 @@ If the widget returns 1, it will receive the data in the immediately following FL_PASTE event. */ - FL_DND_RELEASE = 23 + FL_DND_RELEASE = 23, + + /** The fullscreen state of the window has changed + */ + FL_FULLSCREEN = 24 + }; /** \name When Conditions */ diff -bur fltk-1.3.x-r8732.org/FL/Fl_Widget.H fltk-1.3.x-r8732/FL/Fl_Widget.H --- fltk-1.3.x-r8732.org/FL/Fl_Widget.H 2011-05-26 10:15:26.146232604 +0200 +++ fltk-1.3.x-r8732/FL/Fl_Widget.H 2011-05-26 10:15:53.701455256 +0200 @@ -180,6 +180,7 @@ GROUP_RELATIVE = 1<<16, ///< position this widget relative to the parent group, not to the window COPIED_TOOLTIP = 1<<17, ///< the widget tooltip is internally copied, its destruction is handled by the widget SIMPLE_KEYBOARD = 1<<18, ///< the widget wants simple, consistent keypresses and not advanced input (like character composition and CJK input) +FULLSCREEN = 1<<19, ///< a fullscreen window (Fl_Window) // (space for more flags) USERFLAG3 = 1<<29, ///< reserved for 3rd party extensions USERFLAG2 = 1<<30, ///< reserved for 3rd party extensions @@ -882,6 +883,9 @@ static unsigned int label_shortcut(const char *t); /* Internal use only. */ static int test_shortcut(const char*, const bool require_alt = false); + /* Internal use only. */ + void _set_fullscreen() {flags_ |= FULLSCREEN;} + void _clear_fullscreen() {flags_ &= ~FULLSCREEN;} /** Checks if w is a child of this widget. \param[in] w potential child widget Endast i fltk-1.3.x-r8732/FL: Fl_Widget.H.orig diff -bur fltk-1.3.x-r8732.org/FL/Fl_Window.H fltk-1.3.x-r8732/FL/Fl_Window.H --- fltk-1.3.x-r8732.org/FL/Fl_Window.H 2011-04-15 23:38:05.0 +0200 +++ fltk-1.3.x-r8732/FL/Fl_Window.H 2011-05-26 10:15:39.258959203 +0200 @@ -69,6 +69,7 @@ int minw, minh, maxw, maxh; int dw, dh, aspect; uchar size_range_set; + int no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h; // cursor stuff Fl_Cursor cursor_default; Fl_Color cursor_fg, cursor_bg; @@ -384,15 +385,27 @@ /** Makes the window completely fill the screen, without any window manager border visible. You must use fullscreen_off() to undo -this. This may not work with all window managers. +this. + +\note On some platforms, this can result in the keyboard being +grabbed. The window may also be recreated, meaning hide() and +show() will be called. */ void fullscreen(); /** +Turns off any side effects of fullscreen() + */ + void fullscreen_off(); + /** Turns off any side effects of fullscreen() and does resize(x,y,w,h). */ void fullscreen_off(int,int,int,int); /** +Returns non zero if FULLSCREEN flag is set, 0 otherwise. + */ + unsigned int fullscreen_active() const { return flags() & FULLSCREEN; } + /** Iconifies the window. If you call this when shown() is false it will show() it as an icon. If the window is already iconified this d
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached patch fullscreen17.patch, update patch to better deal with the Windows coordinate mess and to fix windows starting in fullscreen. Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached file "fullscreen17.patch"... Link: http://www.fltk.org/str.php?L2641 Version: 1.4-featureIndex: src/Fl_Window_fullscreen.cxx === --- src/Fl_Window_fullscreen.cxx(revision 8831) +++ src/Fl_Window_fullscreen.cxx(arbetskopia) @@ -60,39 +60,48 @@ #endif } +void fullscreen_x(Fl_Window *w); +void fullscreen_off_x(); +void fullscreen_off_x(Fl_Window *w, int X, int Y, int W, int H); + +/* Note: The previous implementation toggled border(). With this new + implementation this is not necessary. Additionally, if we do that, + the application may lose focus when switching out of fullscreen + mode with some window managers. Besides, the API does not say that + the FLTK border state should be toggled; it only says that the + borders should not be *visible*. +*/ void Fl_Window::fullscreen() { -#ifndef WIN32 - //this would clobber the fake wm, since it relies on the border flags to - //determine its thickness - border(0); -#endif -#if defined(__APPLE__) || defined(WIN32) || defined(USE_X11) - int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, x(), y(), w(), h()); - // if we are on the main screen, we will leave the system menu bar unobstructed - if (Fl::x()>=sx && Fl::y()>=sy && Fl::x()+Fl::w()<=sx+sw && Fl::y()+Fl::h()<=sy+sh) { -sx = Fl::x(); sy = Fl::y(); -sw = Fl::w(); sh = Fl::h(); + if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) { +no_fullscreen_x = x(); +no_fullscreen_y = y(); +no_fullscreen_w = w(); +no_fullscreen_h = h(); +fullscreen_x(this); + } else { +set_flag(FULLSCREEN); } - if (x()==sx) x(sx+1); // make sure that we actually execute the resize -#if defined(USE_X11) - resize(0, 0, w(), h()); // work around some quirks in X11 -#endif - resize(sx, sy, sw, sh); -#else - if (!x()) x(1); // make sure that we actually execute the resize - resize(0,0,Fl::w(),Fl::h()); -#endif } void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { - // this order produces less blinking on IRIX: - resize(X,Y,W,H); -#ifndef WIN32 - border(1); -#endif + if (shown() && (flags() & Fl_Widget::FULLSCREEN)) { +fullscreen_off_x(this, X, Y, W, H); + } else { +clear_flag(FULLSCREEN); + } + no_fullscreen_x = no_fullscreen_y = no_fullscreen_w = no_fullscreen_h = 0; } +void Fl_Window::fullscreen_off() { + if (!no_fullscreen_x && !no_fullscreen_y) { +// Window was initially created fullscreen - default to current monitor +no_fullscreen_x = x(); +no_fullscreen_y = y(); + } + fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); +} + + // // End of "$Id$". // Index: src/Fl_Window.cxx === --- src/Fl_Window.cxx (revision 8831) +++ src/Fl_Window.cxx (arbetskopia) @@ -59,6 +59,10 @@ resizable(0); size_range_set = 0; minw = maxw = minh = maxh = 0; + no_fullscreen_x = 0; + no_fullscreen_y = 0; + no_fullscreen_w = w(); + no_fullscreen_h = h(); callback((Fl_Callback*)default_callback); } Index: src/Fl_grab.cxx === --- src/Fl_grab.cxx (revision 8831) +++ src/Fl_grab.cxx (arbetskopia) @@ -50,7 +50,19 @@ extern void *fl_capture; #endif +#if !(defined(WIN32) || defined(__APPLE__)) +extern int ewmh_supported(); // from Fl_x.cxx +#endif + void Fl::grab(Fl_Window* win) { +Fl_Window *fullscreen_win = NULL; +for (Fl_Window *W = Fl::first_window(); W; W = Fl::next_window(W)) { + if (W->fullscreen_active()) { +fullscreen_win = W; +break; + } +} + if (win) { if (!grab_) { #ifdef WIN32 @@ -60,8 +72,9 @@ fl_capture = Fl_X::i(first_window())->xid; Fl_X::i(first_window())->set_key_window(); #else + Window xid = fullscreen_win ? fl_xid(fullscreen_win) : fl_xid(first_window()); XGrabPointer(fl_display, - fl_xid(first_window()), + xid, 1, ButtonPressMask|ButtonReleaseMask| ButtonMotionMask|PointerMotionMask, @@ -71,7 +84,7 @@ 0, fl_event_time); XGrabKeyboard(fl_display, - fl_xid(first_window()), + xid, 1, GrabModeAsync, GrabModeAsync, @@ -87,7 +100,10 @@ #elif defined(__APPLE__) fl_capture = 0; #else + // We must keep the grab in the non-EWMH fullscreen case + if (!fullscreen_win || ewmh_supported()) { XUngrabKeyboard(fl_display, fl_event_time); + } XUngrabPointer(fl_display, fl_event_time); // this flush is done in case the picked menu item goes into // an infinite loop, so
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached updated patch, fullscreen16.patch. This patch fixes several problems with the previous implementation: * On Windows, the window was shrinking somewhat every time we switched to non-fullscreen mode. * ewmh_supported() was broken, due to signed/unsigned variables. * We are now correctly grabbing the keyboard in override-redirect mode, still supporting popup dialogs in front the the O-R window. * Optimized EWMH code: Avoids unnecessary resizes. * Improved OS X implementation, which works better when switching between a fullscreen and normal application. Also note that since STR #2640 and STR #2646 have been applied, this patch no longer depends on other patches. Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Attached file "fullscreen16.patch"... Link: http://www.fltk.org/str.php?L2641 Version: 1.4-featureIndex: src/Fl_Window_fullscreen.cxx === --- src/Fl_Window_fullscreen.cxx(revision 8739) +++ src/Fl_Window_fullscreen.cxx(arbetskopia) @@ -60,39 +60,48 @@ #endif } +void fullscreen_x(Fl_Window *w); +void fullscreen_off_x(); +void fullscreen_off_x(Fl_Window *w, int X, int Y, int W, int H); + +/* Note: The previous implementation toggled border(). With this new + implementation this is not necessary. Additionally, if we do that, + the application may lose focus when switching out of fullscreen + mode with some window managers. Besides, the API does not say that + the FLTK border state should be toggled; it only says that the + borders should not be *visible*. +*/ void Fl_Window::fullscreen() { -#ifndef WIN32 - //this would clobber the fake wm, since it relies on the border flags to - //determine its thickness - border(0); -#endif -#if defined(__APPLE__) || defined(WIN32) || defined(USE_X11) - int sx, sy, sw, sh; - Fl::screen_xywh(sx, sy, sw, sh, x(), y(), w(), h()); - // if we are on the main screen, we will leave the system menu bar unobstructed - if (Fl::x()>=sx && Fl::y()>=sy && Fl::x()+Fl::w()<=sx+sw && Fl::y()+Fl::h()<=sy+sh) { -sx = Fl::x(); sy = Fl::y(); -sw = Fl::w(); sh = Fl::h(); + if (shown() && !(flags() & Fl_Widget::FULLSCREEN)) { +no_fullscreen_x = x(); +no_fullscreen_y = y(); +no_fullscreen_w = w(); +no_fullscreen_h = h(); +fullscreen_x(this); + } else { +set_flag(FULLSCREEN); } - if (x()==sx) x(sx+1); // make sure that we actually execute the resize -#if defined(USE_X11) - resize(0, 0, w(), h()); // work around some quirks in X11 -#endif - resize(sx, sy, sw, sh); -#else - if (!x()) x(1); // make sure that we actually execute the resize - resize(0,0,Fl::w(),Fl::h()); -#endif } void Fl_Window::fullscreen_off(int X,int Y,int W,int H) { - // this order produces less blinking on IRIX: - resize(X,Y,W,H); -#ifndef WIN32 - border(1); -#endif + if (shown() && (flags() & Fl_Widget::FULLSCREEN)) { +fullscreen_off_x(this, X, Y, W, H); + } else { +clear_flag(FULLSCREEN); + } + no_fullscreen_x = no_fullscreen_y = no_fullscreen_w = no_fullscreen_h = 0; } +void Fl_Window::fullscreen_off() { + if (!no_fullscreen_x && !no_fullscreen_y) { +// Window was initially created fullscreen - default to current monitor +no_fullscreen_x = x(); +no_fullscreen_y = y(); + } + fullscreen_off(no_fullscreen_x, no_fullscreen_y, no_fullscreen_w, no_fullscreen_h); +} + + // // End of "$Id$". // Index: src/Fl_Window.cxx === --- src/Fl_Window.cxx (revision 8739) +++ src/Fl_Window.cxx (arbetskopia) @@ -59,6 +59,10 @@ resizable(0); size_range_set = 0; minw = maxw = minh = maxh = 0; + no_fullscreen_x = 0; + no_fullscreen_y = 0; + no_fullscreen_w = w(); + no_fullscreen_h = h(); callback((Fl_Callback*)default_callback); } Index: src/Fl_grab.cxx === --- src/Fl_grab.cxx (revision 8739) +++ src/Fl_grab.cxx (arbetskopia) @@ -50,7 +50,19 @@ extern void *fl_capture; #endif +#if !(defined(WIN32) || defined(__APPLE__)) +extern int ewmh_supported(); // from Fl_x.cxx +#endif + void Fl::grab(Fl_Window* win) { +Fl_Window *fullscreen_win = NULL; +for (Fl_Window *W = Fl::first_window(); W; W = Fl::next_window(W)) { + if (W->fullscreen_active()) { + fullscreen_win = W; + break; + } +} + if (win) { if (!grab_) { #ifdef WIN32 @@ -60,8 +72,9 @@ fl_capture = Fl_X::i(first_window())->xid; Fl_X::i(first_window())->set_key_window(); #else + Window xid = fullscreen_win ? fl_xid(fullscreen_win) : fl_xid(first_window()); XGrabPointer(fl_display, - fl_xid(first_window()), + xid, 1, ButtonPressMask|ButtonReleaseMask| ButtonMotionMask|PointerMotionMask, @@ -71,7 +84,7 @@ 0, fl_event_time); XGrabKeyboard(fl_display, - fl_xid(first_window()), + xid, 1, GrabModeAsync, GrabModeAsync, @@ -87,7 +100,10 @@ #elif defined(__APPLE__) fl_capture = 0; #else - XUngrabKeyboard(fl_display, fl_event_time); + // We must keep the grab in the non-EWMH fullscreen case + if (!fullscreen_win || ewmh_supported()) { + XUngrabKeyboard(fl_display, fl_event_time); + } XUngrabPointer(fl_display, fl_event_time); // this flush is done in case
Re: [fltk.development] [RFE] STR #2641: Implement proper fullscreen support
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW. [STR New] Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature Changed priority to RFE. Many thanks for your patch, this looks interesting. However, this proposal is too big to make it in release 1.3.0, but will be considered later. Moving it to 1.4 for now. Link: http://www.fltk.org/str.php?L2641 Version: 1.4-feature ___ fltk-dev mailing list fltk-dev@easysw.com http://lists.easysw.com/mailman/listinfo/fltk-dev