|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
gnome-session blinken IDLETIME problemOkay, after having F11 g-p-m blank the screen on me (not using
nouveau, that's a separate issue) whilst watching some short videos in totem yesterday, I got really angry. I've audited all the IDLETIME code in gnome-power-manager, and when I've run it in a console and watched the output, it all seems to work 100% okay. It only seems to fall over gnome-session is involved with handling inhibits. So, we have working: GPMIDLEDEBUG=1 gnome-power-manager ...wait 10 seconds... IDLETIME fires the idle alarm expired (and g-p-m dims the screen) ...move the mouse... IDLETIME fires the reset alarm expired then I issue an inhibit request to org.gnome.SessionManager with parameters ('moo',0,'testing',8) using d-feet and get back a cookie like normal. Session becomes inhibited. ...wait 10 seconds... IDLETIME fires the idle alarm expired (but g-p-m doesn't dim the screen, as the session is inhibited from totem) ...move the mouse... NOTHING. No event from X. ...close d-feet... the inhibit gets auto-revoked, session becomes non-inhibited, and g-p-m assumes that x has been idle for a long time, and also the session is not inhibited, and so switches off the screen. You can see this using GPMIDLEDEBUG as the second icon is a box, not a computer icon. Now g-p-m is confused, and has to be restarted before it will reset the new idletime counter. You can't reproduce with the original idlecounter-demo program when using XNextEvent, but you can as soon as you hook into gdk with gdk_window_add_filter. It really looks like something is doing GDK_FILTER_REMOVE on the reset alarm at some point. As an aside, it appears totem is inhibiting using gnome-screensaver as a proxy, although I don't this this is the problem as it also can be done using d-feet. After looking in the forums, this problem looks like it's triggered lots, and by many different users. I would appreciate any help here. Richard. _______________________________________________ gnome-power-manager-list mailing list gnome-power-manager-list@... http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list |
|
|
Re: gnome-session blinken IDLETIME problem2009/7/29 Richard Hughes <hughsient@...>:
> Okay, after having F11 g-p-m blank the screen on me (not using > nouveau, that's a separate issue) whilst watching some short videos in > totem yesterday, I got really angry. Attached is 130 line demo code illustrating the problem. Notice the lack of "DEBUG: Reset" lines when there is a session inhibit. Do it without gnome-power-manager running and observe the brokenness. Richard. //gcc -o idlecounter-demo idlecounter-demo.c `pkg-config --cflags --libs gtk+-2.0` -Wall #include <gdk/gdkx.h> #include <gdk/gdk.h> #include <gtk/gtk.h> #include <stdio.h> #include <string.h> #include <X11/Xlib.h> #include <X11/extensions/sync.h> #include <stdio.h> #include <string.h> static XSyncCounter idle_counter = None; static XSyncAlarm timeout_alarm = None; static XSyncAlarm reset_alarm = None; static Display *dpy; static int sync_event; #define TIMEOUT 2000 /* ms */ static void test_set_alarm (Display *dpy, XSyncAlarm *alarm, XSyncCounter counter, XSyncTestType test, XSyncValue value) { XSyncAlarmAttributes attr; XSyncValue delta; unsigned int flags; XSyncIntToValue (&delta, 0); attr.trigger.counter = counter; attr.trigger.value_type = XSyncAbsolute; attr.trigger.test_type = test; attr.trigger.wait_value = value; attr.delta = delta; flags = XSyncCACounter | XSyncCAValueType | XSyncCATestType | XSyncCAValue | XSyncCADelta; if (*alarm) XSyncChangeAlarm (dpy, *alarm, flags, &attr); else *alarm = XSyncCreateAlarm (dpy, flags, &attr); } /** * test_filter_cb: */ static GdkFilterReturn test_filter_cb (GdkXEvent *gdkxevent, GdkEvent *gdkevent, gpointer data) { static gint count = 0; XEvent *xevent = (XEvent *) gdkxevent; XSyncAlarmNotifyEvent *alarm_event; XSyncValue timeout; /* no point continuing */ if (xevent->type != sync_event + XSyncAlarmNotify) return GDK_FILTER_CONTINUE; alarm_event = (XSyncAlarmNotifyEvent *) xevent; if (alarm_event->alarm == timeout_alarm) { g_debug ("Timeout %i", count++); /* Don't match on the current value because * XSyncNegativeComparison means less or equal. */ int overflow; XSyncValue add; XSyncValue plusone; XSyncIntToValue (&add, -1); XSyncValueAdd (&plusone, alarm_event->counter_value, add, &overflow); /* Set the reset alarm to fire the next time * idle_counter < the current counter value */ test_set_alarm (dpy, &reset_alarm, idle_counter, XSyncNegativeTransition, plusone); } else if (alarm_event->alarm == reset_alarm) { g_debug ("Reset"); XSyncIntToValue (&timeout, TIMEOUT); test_set_alarm (dpy, &timeout_alarm, idle_counter, XSyncPositiveTransition, timeout); } return GDK_FILTER_CONTINUE; } int main (int argc, char **argv) { int sync_error; int sync_major, sync_minor; int ncounters; XSyncSystemCounter *counters; XSyncValue timeout; gint i; gtk_init (&argc, &argv); dpy = GDK_DISPLAY (); if (!XSyncQueryExtension (dpy, &sync_event, &sync_error)) { g_debug ("No Sync extension"); return 1; } XSyncInitialize (dpy, &sync_major, &sync_minor); counters = XSyncListSystemCounters (dpy, &ncounters); for (i = 0; i < ncounters && !idle_counter; i++) { if (!strcmp(counters[i].name, "IDLETIME")) idle_counter = counters[i].counter; } if (!idle_counter) { g_debug ("No idle counter"); return 1; } /* setup timeout */ XSyncIntToValue (&timeout, TIMEOUT); test_set_alarm (dpy, &timeout_alarm, idle_counter, XSyncPositiveTransition, timeout); /* catch the timer alarm */ g_debug ("Adding filter"); gdk_window_add_filter (NULL, test_filter_cb, NULL); g_debug ("Waiting for timeout"); gtk_main (); return 0; } _______________________________________________ gnome-power-manager-list mailing list gnome-power-manager-list@... http://mail.gnome.org/mailman/listinfo/gnome-power-manager-list |
| Free embeddable forum powered by Nabble | Forum Help |