Mailing List archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[vdr] Re: [ANNOUNCE] vdr-softdevice-0.0.7pre2
On Sun, 2004-07-25 at 22:16, Stefan Lucke wrote:
> Hi,
>
> next pre release of softdevice plugin is ready.
Here's a patch to enable toggling fullscreen with f on the keyboard or
double click inside the window.
--
Torgeir Veimo <torgeir@pobox.com>
--- softdevice-0.0.7pre2-orig/video-xv.c 2004-07-23 20:43:15.000000000 +0100
+++ softdevice-0.0.7pre2/video-xv.c 2004-07-26 22:30:44.459083008 +0100
@@ -278,6 +278,24 @@
/* ---------------------------------------------------------------------------
*/
+void cXvVideoOut::toggleFullScreen(void)
+{
+ fullScreen = !fullScreen;
+ XEvent e;
+
+ memset(&e,0,sizeof(e));
+ e.xclient.type = ClientMessage;
+ e.xclient.message_type = _NET_WM_STATE;
+ e.xclient.display = dpy;
+ e.xclient.window = win;
+ e.xclient.format = 32;
+ e.xclient.data.l[0] = fullScreen ? 1 : 0;
+ e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN;
+ XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureRedirectMask, &e);
+}
+
+/* ---------------------------------------------------------------------------
+ */
void cXvVideoOut::ProcessEvents ()
{
@@ -286,6 +304,7 @@
int len;
XComposeStatus compose;
KeySym keysym;
+ struct timeval current_time;
while (XCheckMaskEvent (dpy, /* win, */
PointerMotionMask |
@@ -300,12 +319,18 @@
{
case MotionNotify:
case ButtonPress:
+ gettimeofday(¤t_time, NULL);
+ motion_time = current_time.tv_sec;
+ if(event.xbutton.button==Button1) {
+ if(button_time - current_time.tv_sec == 0) {
+ toggleFullScreen();
+ }
+ button_time = current_time.tv_sec;
+ }
if(cursor_visible == False) {
XUndefineCursor(dpy, win);
cursor_visible = True;
}
- gettimeofday(&prev_time, NULL);
- cur_time.tv_sec = prev_time.tv_sec;
break;
case ConfigureNotify:
dwidth = event.xconfigure.width;
@@ -324,8 +349,8 @@
XUndefineCursor(dpy, win);
cursor_visible = True;
}
- gettimeofday(&prev_time, NULL);
- cur_time.tv_sec = prev_time.tv_sec;
+ gettimeofday(¤t_time, NULL);
+ button_time = current_time.tv_sec;
len = XLookupString (&event. xkey, buffer, 80, &keysym, &compose);
switch (keysym)
@@ -334,6 +359,9 @@
case XK_Caps_Lock: case XK_Shift_Lock: case XK_Meta_L:
case XK_Meta_R: case XK_Alt_L: case XK_Alt_R:
break;
+ case 'f':
+ toggleFullScreen();
+ break;
case 'b':
attributeStore.Decrement("XV_BRIGHTNESS");
break;
@@ -409,8 +437,8 @@
}
}
if(cursor_visible == True) {
- gettimeofday(&prev_time, NULL);
- if(prev_time.tv_sec - cur_time.tv_sec >= 2) {
+ gettimeofday(¤t_time, NULL);
+ if(current_time.tv_sec - motion_time >= 2) {
XDefineCursor(dpy, win, hidden_cursor);
cursor_visible = False;
}
@@ -466,6 +494,7 @@
XSizeHints hints;
XGCValues values;
XTextProperty x_wname, x_iname;
+ struct timeval current_time;
dsyslog("[XvVideoOut]: patch version (%s)", PATCH_VERSION);
@@ -547,8 +576,12 @@
&dummy_col, &dummy_col, 0, 0);
XFreePixmap(dpy, cursor_mask);
cursor_visible = True;
- gettimeofday(&prev_time, NULL);
- cur_time.tv_sec = prev_time.tv_sec;
+ gettimeofday(¤t_time, NULL);
+ button_time = motion_time = current_time.tv_sec;
+
+ _NET_WM_STATE_FULLSCREEN = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
+ _NET_WM_STATE = XInternAtom(dpy, "_NET_WM_STATE", False);
+ fullScreen = false;
/* -----------------------------------------------------------------------
* now let's do some OSD initialisations
--- softdevice-0.0.7pre2-orig/video-xv.h 2004-07-23 20:43:15.000000000 +0100
+++ softdevice-0.0.7pre2/video-xv.h 2004-07-26 22:17:27.143293432 +0100
@@ -93,7 +93,8 @@
Window rwin, win;
Cursor hidden_cursor;
Bool cursor_visible;
- struct timeval prev_time, cur_time;
+ long motion_time, button_time;
+ Atom _NET_WM_STATE_FULLSCREEN, _NET_WM_STATE;
int initialized,
osd_refresh_counter,
osd_skip_counter,
@@ -127,6 +128,10 @@
int xres, yres;
uint64_t lastUpdate;
+ bool fullScreen;
+ void toggleFullScreen(void);
+
+
public:
cXvVideoOut();
cXvVideoOut (int aspect = DV_FORMAT_NORMAL, int port = 0, int crop = 0,
Home |
Main Index |
Thread Index