diff options
author | Johns <johns98@gmx.net> | 2012-01-13 16:31:29 +0100 |
---|---|---|
committer | Johns <johns98@gmx.net> | 2012-01-13 16:31:29 +0100 |
commit | 7f7de8678f930e4476ade1cbf86edecf45c7689d (patch) | |
tree | 899395582f627c3c39d857602e45a18688a4eac5 /video.c | |
parent | 92bb00c410726a203849137fd13cf8e10ed75861 (diff) | |
download | vdr-plugin-softhddevice-7f7de8678f930e4476ade1cbf86edecf45c7689d.tar.gz vdr-plugin-softhddevice-7f7de8678f930e4476ade1cbf86edecf45c7689d.tar.bz2 |
Add support for fullscreen mode.
Diffstat (limited to 'video.c')
-rw-r--r-- | video.c | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -93,6 +93,7 @@ #include <xcb/xcb_image.h> #include <xcb/xcb_event.h> #include <xcb/xcb_atom.h> +#include <xcb/xcb_ewmh.h> #include <xcb/xcb_icccm.h> #include <xcb/xcb_keysyms.h> #endif @@ -242,6 +243,8 @@ static VideoZoomModes Video4to3ZoomMode; static char Video60HzMode; ///< handle 60hz displays static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message +static xcb_atom_t NetWmState; ///< wm-state message atom +static xcb_atom_t NetWmStateFullscreen; ///< fullscreen wm-state message atom extern uint32_t VideoSwitch; ///< ticks for channel switch @@ -6119,6 +6122,9 @@ static void VideoEvent(void) VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y, event.xconfigure.width, event.xconfigure.height); break; + case ButtonPress: + VideoSetFullscreen(-1); + break; case KeyPress: keysym = XLookupKeysym(&event.xkey, 0); #if 0 @@ -6690,6 +6696,22 @@ static void VideoCreateWindow(xcb_window_t parent, xcb_visualid_t visual, free(reply); } } + // + // prepare fullscreen. + // + if ((reply = + xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, + sizeof("_NET_WM_STATE") - 1, "_NET_WM_STATE"), NULL))) { + NetWmState = reply->atom; + free(reply); + } + if ((reply = + xcb_intern_atom_reply(Connection, xcb_intern_atom(Connection, 0, + sizeof("_NET_WM_STATE_FULLSCREEN") - 1, + "_NET_WM_STATE_FULLSCREEN"), NULL))) { + NetWmStateFullscreen = reply->atom; + free(reply); + } xcb_map_window(Connection, VideoWindow); @@ -6793,6 +6815,37 @@ void VideoSetVideoMode(int x, int y, int width, int height) } /// +/// Send fullscreen message to window. +/// +/// @param onoff -1 toggle, true turn on, false turn off +/// +void VideoSetFullscreen(int onoff) +{ + xcb_client_message_event_t event; + + memset(&event, 0, sizeof(event)); + event.response_type = XCB_CLIENT_MESSAGE; + event.format = 32; + event.window = VideoWindow; + event.type = NetWmState; + if (onoff < 0) { + event.data.data32[0] = XCB_EWMH_WM_STATE_TOGGLE; + } else if (onoff) { + event.data.data32[0] = XCB_EWMH_WM_STATE_ADD; + } else { + event.data.data32[0] = XCB_EWMH_WM_STATE_REMOVE; + } + event.data.data32[1] = NetWmStateFullscreen; + + xcb_send_event(Connection, XCB_SEND_EVENT_DEST_POINTER_WINDOW, + DefaultRootWindow(XlibDisplay), + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (void *)&event); + Debug(3, "video/x11: send fullscreen message %x %x\n", + event.data.data32[0], event.data.data32[1]); +} + +/// /// Set deinterlace mode. /// void VideoSetDeinterlace(int mode[VideoResolutionMax]) |