Update of /cvsroot/xine/xine-ui/src/xitk
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv16204
Modified Files:
event_sender.c
Log Message:
Fixed infinite event handling loop from ConfigureNotify with sticky window,
caused by a window move request in response to the event.
a) KWin (at least v3.2) sends two events instead of one, even when coordinates
didn't change, but the code can't know the number of events in advance and
was only prepared to ignore one, perpetually causing new events be generated
in consequence of response to the second event.
b) An application should not try to move its window back to a desired position
upon a ConfigureNotify. If a WM doesn't honour this position, an infinite
loop results.
Small code cleanup.
Index: event_sender.c
===================================================================
RCS file: /cvsroot/xine/xine-ui/src/xitk/event_sender.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- event_sender.c 6 May 2005 23:32:33 -0000 1.30
+++ event_sender.c 15 Feb 2007 23:49:19 -0000 1.31
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2007 the xine project
*
* This file is part of xine, a unix video player.
*
@@ -50,7 +50,6 @@
int x;
int y;
- int move_forced;
xitk_widget_list_t *widget_list;
@@ -89,44 +88,28 @@
static char *menu_items_dvd[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL };
void event_sender_sticky_cb(void *data, xine_cfg_entry_t *cfg) {
+ int old_sticky_value = gGui->eventer_sticky;
- if(!eventer)
- gGui->eventer_sticky = cfg->num_value;
- else {
- int old_sticky_value = gGui->eventer_sticky;
- gGui->eventer_sticky = cfg->num_value;
-
+ gGui->eventer_sticky = cfg->num_value;
+ if(eventer) {
if((!old_sticky_value) && gGui->eventer_sticky) {
- int px, py, pw, ph;
- xitk_get_window_position(gGui->display, gGui->panel_window, &px, &py,
&pw, &ph);
+ int px, py, pw;
+ xitk_get_window_position(gGui->display, gGui->panel_window, &px, &py,
&pw, NULL);
eventer->x = px + pw;
eventer->y = py;
- eventer->move_forced++;
xitk_window_move_window(gGui->imlib_data, eventer->xwin, eventer->x,
eventer->y);
}
}
-
}
static void event_sender_store_new_position(int x, int y, int w, int h) {
- if(gGui->eventer_sticky) {
- if(eventer->move_forced == 0) {
- if(panel_is_visible()) {
- eventer->move_forced++;
- xitk_window_move_window(gGui->imlib_data, eventer->xwin, eventer->x,
eventer->y);
- }
- }
- else
- eventer->move_forced--;
- }
- else {
+ if(eventer && !gGui->eventer_sticky) {
eventer->x = x;
eventer->y = y;
config_update_num ("gui.eventer_x", x);
config_update_num ("gui.eventer_y", y);
}
-
}
void event_sender_show_tips(int enabled, unsigned long timeout) {
@@ -218,6 +201,20 @@
switch(event->type) {
+ case ButtonRelease:
+ /*
+ * If we tried to move sticky window, move it back to stored position.
+ */
+ if(eventer && gGui->eventer_sticky) {
+ if(panel_is_visible()) {
+ int x, y;
+ xitk_window_get_window_position(gGui->imlib_data, eventer->xwin, &x,
&y, NULL, NULL);
+ if((x != eventer->x) || (y != eventer->y))
+ xitk_window_move_window(gGui->imlib_data, eventer->xwin, eventer->x,
eventer->y);
+ }
+ }
+ break;
+
case KeyPress:
{
XKeyEvent mykeyevent;
@@ -234,7 +231,7 @@
switch(key) {
case XK_Up:
event_sender_up(NULL, NULL);
- break;
+ break;
case XK_Down:
event_sender_down(NULL, NULL);
break;
@@ -243,7 +240,7 @@
break;
case XK_Right:
event_sender_right(NULL, NULL);
- break;
+ break;
case XK_Return:
case XK_KP_Enter:
@@ -427,8 +424,8 @@
CONFIG_NO_DATA);
if(gGui->eventer_sticky && panel_is_visible()) {
- int px, py, pw, ph;
- xitk_get_window_position(gGui->display, gGui->panel_window, &px, &py, &pw,
&ph);
+ int px, py, pw;
+ xitk_get_window_position(gGui->display, gGui->panel_window, &px, &py, &pw,
NULL);
eventer->x = px + pw;
eventer->y = py;
}
@@ -714,7 +711,6 @@
eventer->visible = 1;
eventer->running = 1;
- eventer->move_forced = 0;
event_sender_raise_window();
try_to_set_input_focus(xitk_window_get_window(eventer->xwin));
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog