[Solutions] Running a FLTK 1.1 app in actual fullscreen
by Benjamin Schieder
#include
#include
extern Display *fl_display;
extern Window fl_window;
extern GC fl_gc;
extern int fl_screen;
extern XVisualInfo *fl_visual;
extern Colormap fl_colormap;
bool isfullscreen = false;
void FullscreenCallbackMenu(Fl_Widget *w, void *p) {
fl_open_display(); // make sure display connection is open
XEvent xev;
ROOTWINDOW->make_current(); // ROOTWINDOW is the window you want to make fullscreen
/* init X event structure for _NET_WM_FULLSCREEN client msg */
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.message_type = XInternAtom(fl_display, "_NET_WM_STATE", False);
xev.xclient.window = fl_window;
xev.xclient.format = 32;
xev.xclient.data.l[0] = (isfullscreen ? 0 : 1);
xev.xclient.data.l[1] = XInternAtom(fl_display, "_NET_WM_STATE_FULLSCREEN", False);
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
isfullscreen = ! isfullscreen;
/* finally send that damn thing */
XSendEvent(fl_display, DefaultRootWindow(fl_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XSync(fl_display, False);
}
#include
extern Display *fl_display;
extern Window fl_window;
extern GC fl_gc;
extern int fl_screen;
extern XVisualInfo *fl_visual;
extern Colormap fl_colormap;
bool isfullscreen = false;
void FullscreenCallbackMenu(Fl_Widget *w, void *p) {
fl_open_display(); // make sure display connection is open
XEvent xev;
ROOTWINDOW->make_current(); // ROOTWINDOW is the window you want to make fullscreen
/* init X event structure for _NET_WM_FULLSCREEN client msg */
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.message_type = XInternAtom(fl_display, "_NET_WM_STATE", False);
xev.xclient.window = fl_window;
xev.xclient.format = 32;
xev.xclient.data.l[0] = (isfullscreen ? 0 : 1);
xev.xclient.data.l[1] = XInternAtom(fl_display, "_NET_WM_STATE_FULLSCREEN", False);
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
isfullscreen = ! isfullscreen;
/* finally send that damn thing */
XSendEvent(fl_display, DefaultRootWindow(fl_display), False, SubstructureRedirectMask | SubstructureNotifyMask, &xev);
XSync(fl_display, False);
}
The function can be used as a callback for any Fl_Widget and is mostly taken from mplayers code for OMAP video output and adapted for FLTK variable names.
EOF
Subscribe via RSS