View | Details | Raw Unified | Return to bug 304399
Collapse All | Expand All

(-)gnome-screensaver-2.14.0-orig/src/gnome-screensaver-dialog.c (+1 lines)
Lines 183-188 response_cb (GSLockPlug *plug, Link Here
183
                break;
183
                break;
184
        }
184
        }
185
185
186
	gtk_widget_destroy (GTK_WIDGET (plug));
186
        gtk_main_quit ();
187
        gtk_main_quit ();
187
}
188
}
188
189
(-)gnome-screensaver-2.14.0-orig/src/gs-lock-plug.c (+23 lines)
Lines 23-28 Link Here
23
#include "config.h"
23
#include "config.h"
24
24
25
#include <stdlib.h>
25
#include <stdlib.h>
26
#include <sys/wait.h>
26
#include <unistd.h>
27
#include <unistd.h>
27
#include <string.h>
28
#include <string.h>
28
#include <errno.h>
29
#include <errno.h>
Lines 145-150 struct GSLockPlugPrivate Link Here
145
        guint        response_idle_id;
146
        guint        response_idle_id;
146
147
147
        GTimeVal     start_time;
148
        GTimeVal     start_time;
149
150
	GPid         xvkbd_pid;
148
};
151
};
149
152
150
typedef struct _ResponseData ResponseData;
153
typedef struct _ResponseData ResponseData;
Lines 1727-1732 gs_lock_plug_init (GSLockPlug *plug) Link Here
1727
        g_signal_connect (plug->priv->logout_button, "clicked",
1730
        g_signal_connect (plug->priv->logout_button, "clicked",
1728
                          G_CALLBACK (logout_button_clicked), plug);
1731
                          G_CALLBACK (logout_button_clicked), plug);
1729
1732
1733
	int status = system ("hal-find-by-property --key system.formfactor.subtype --string tabletpc");
1734
	if (WIFEXITED (status) && WEXITSTATUS (status) == 0) {
1735
		gchar **argv[] = { "/usr/X11R6/bin/xvkbd", "-always-on-top", "-compact", "-geometry", "-0-0", NULL };
1736
		GError *error = NULL;
1737
1738
		if (!g_spawn_async (g_get_home_dir (), argv, NULL, 0, NULL, NULL,
1739
				    &plug->priv->xvkbd_pid, &error)) {
1740
			g_warning ("Could not spawn xvkbd: %s\n", error->message);
1741
			g_error_free (error);
1742
1743
			plug->priv->xvkbd_pid = -1;
1744
		}
1745
	} else
1746
		plug->priv->xvkbd_pid = -1;
1747
1730
        profile_end ("end", NULL);
1748
        profile_end ("end", NULL);
1731
}
1749
}
1732
1750
Lines 1742-1747 gs_lock_plug_finalize (GObject *object) Link Here
1742
1760
1743
        g_return_if_fail (plug->priv != NULL);
1761
        g_return_if_fail (plug->priv != NULL);
1744
1762
1763
	if (plug->priv->xvkbd_pid != -1) {
1764
		kill (plug->priv->xvkbd_pid, 9);
1765
		plug->priv->xvkbd_pid = -1;
1766
	}
1767
1745
        g_free (plug->priv->logout_command);
1768
        g_free (plug->priv->logout_command);
1746
1769
1747
        if (plug->priv->fusa_manager) {
1770
        if (plug->priv->fusa_manager) {
(-)gnome-screensaver-2.14.0-orig/src/gs-window-x11.c (-3 / +67 lines)
Lines 413-423 x11_window_is_ours (Window window) Link Here
413
        gwindow = gdk_window_lookup (window);
413
        gwindow = gdk_window_lookup (window);
414
        if (gwindow && (window != GDK_ROOT_WINDOW ())) {
414
        if (gwindow && (window != GDK_ROOT_WINDOW ())) {
415
                ret = TRUE;
415
                ret = TRUE;
416
        }
416
	}
417
417
418
        return ret;
418
        return ret;
419
}
419
}
420
420
421
#define GET_DISPLAY gdk_x11_display_get_xdisplay (gdk_display_get_default ())
422
423
static gboolean
424
is_xvkbd_window (Window window)
425
{
426
	gboolean ret = FALSE;
427
	XClassHint class_hint;
428
429
	if (XGetClassHint (GET_DISPLAY, window, &class_hint) == Success) {
430
		if (g_strstr_len (class_hint.res_name,
431
				  strlen (class_hint.res_name),
432
				  "xvkbd"))
433
			ret = TRUE;
434
	}
435
436
	return ret;
437
}
438
439
static void
440
setup_xvkbd_window (Window window)
441
{
442
	XWithdrawWindow (GET_DISPLAY, window, gdk_x11_get_default_screen ());
443
	for(;;) {
444
		Atom type;
445
		int format;
446
		unsigned long length, after;
447
		unsigned char *data;
448
		int r;
449
450
		r = XGetWindowProperty (GET_DISPLAY,
451
					window, XInternAtom (GET_DISPLAY, "WM_STATE", TRUE), 0, 2,
452
					FALSE, AnyPropertyType, &type, &format,
453
					&length, &after, &data );
454
		gboolean withdrawn = TRUE;
455
		if (r == Success && data && format == 32) {
456
			guint32 *wstate = (guint32 *) data;
457
			withdrawn  = (*wstate == WithdrawnState );
458
			XFree ((char *) data);
459
		}
460
		if (withdrawn)
461
			break;
462
	}
463
464
	XSelectInput (GET_DISPLAY, window, StructureNotifyMask);
465
	XWindowAttributes attr_geom;
466
467
	if (!XGetWindowAttributes (GET_DISPLAY, window, &attr_geom ))
468
		return;
469
	int x = XDisplayWidth (GET_DISPLAY, gdk_x11_get_default_screen ()) - attr_geom.width;
470
	int y = XDisplayHeight (GET_DISPLAY, gdk_x11_get_default_screen ()) - attr_geom.height;
471
472
	XSetWindowAttributes attr;
473
	attr.override_redirect = True;
474
	XChangeWindowAttributes (GET_DISPLAY, window, CWOverrideRedirect, &attr);
475
	XReparentWindow (GET_DISPLAY, window, GDK_ROOT_WINDOW(), x, y );
476
	XMapWindow (GET_DISPLAY, window);
477
}
478
421
static void
479
static void
422
gs_window_xevent (GSWindow  *window,
480
gs_window_xevent (GSWindow  *window,
423
                  GdkXEvent *xevent)
481
                  GdkXEvent *xevent)
Lines 434-440 gs_window_xevent (GSWindow *window, Link Here
434
                        XMapEvent *xme = &ev->xmap;
492
                        XMapEvent *xme = &ev->xmap;
435
493
436
                        if (! x11_window_is_ours (xme->window)) {
494
                        if (! x11_window_is_ours (xme->window)) {
437
                                gs_window_raise (window);
495
				if (is_xvkbd_window (xme->window))
496
					setup_xvkbd_window (xme->window);	
497
				else
498
                                	gs_window_raise (window);
438
                        } else {
499
                        } else {
439
                                gs_debug ("not raising our windows");
500
                                gs_debug ("not raising our windows");
440
                        }
501
                        }
Lines 446-452 gs_window_xevent (GSWindow *window, Link Here
446
                        XConfigureEvent *xce = &ev->xconfigure;
507
                        XConfigureEvent *xce = &ev->xconfigure;
447
508
448
                        if (! x11_window_is_ours (xce->window)) {
509
                        if (! x11_window_is_ours (xce->window)) {
449
                                gs_window_raise (window);
510
				if (is_xvkbd_window (xce->window))
511
					XRaiseWindow (GET_DISPLAY, xce->window);
512
				else
513
                                	gs_window_raise (window);
450
                        } else {
514
                        } else {
451
                                gs_debug ("not raising our windows");
515
                                gs_debug ("not raising our windows");
452
                        }
516
                        }

Return to bug 304399