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

(-)gnome-screensaver-2.18.1-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 98-103 struct GSLockPlugPrivate Link Here
98
        guint        response_idle_id;
99
        guint        response_idle_id;
99
100
100
        GList       *key_events;
101
        GList       *key_events;
102
103
        GPid         xvkbd_pid;
101
};
104
};
102
105
103
typedef struct _ResponseData ResponseData;
106
typedef struct _ResponseData ResponseData;
Lines 1555-1560 gs_lock_plug_init (GSLockPlug *plug) Link Here
1555
1558
1556
        g_signal_connect (plug, "delete_event", G_CALLBACK (delete_handler), NULL);
1559
        g_signal_connect (plug, "delete_event", G_CALLBACK (delete_handler), NULL);
1557
1560
1561
        //int status = system ("hal-find-by-property --key system.formfactor.subtype --string tabletpc");
1562
        //if (WIFEXITED (status) && WEXITSTATUS (status) == 0) {
1563
                gchar **argv[] = { "/usr/bin/xvkbd", "-always-on-top", "-compact", "-geometry", "-0-0", NULL };
1564
                GError *error = NULL;
1565
1566
                if (!g_spawn_async (g_get_home_dir (), argv, NULL, 0, NULL, NULL,
1567
                                    &plug->priv->xvkbd_pid, &error)) {
1568
                        g_warning ("Could not spawn xvkbd: %s\n", error->message);
1569
                        g_error_free (error);
1570
1571
                        plug->priv->xvkbd_pid = -1;
1572
                }
1573
        //} else
1574
        //        plug->priv->xvkbd_pid = -1;
1575
1558
        gs_profile_end (NULL);
1576
        gs_profile_end (NULL);
1559
}
1577
}
1560
1578
Lines 1570-1575 gs_lock_plug_finalize (GObject *object) Link Here
1570
1588
1571
        g_return_if_fail (plug->priv != NULL);
1589
        g_return_if_fail (plug->priv != NULL);
1572
1590
1591
        if (plug->priv->xvkbd_pid != -1) {
1592
                kill (plug->priv->xvkbd_pid, 9);
1593
                plug->priv->xvkbd_pid = -1;
1594
        }
1595
1573
        g_free (plug->priv->logout_command);
1596
        g_free (plug->priv->logout_command);
1574
1597
1575
        remove_response_idle (plug);
1598
        remove_response_idle (plug);
(-)gnome-screensaver-2.18.1-orig/src/gs-window-x11.c (-2 / +42 lines)
Lines 618-623 x11_window_is_ours (Window window) Link Here
618
        return ret;
618
        return ret;
619
}
619
}
620
620
621
#define GET_DISPLAY gdk_x11_display_get_xdisplay (gdk_display_get_default ())
622
GdkWindow *xvkbd_window = NULL;
623
static gboolean
624
is_xvkbd_window (Window window)
625
{
626
        gboolean ret = FALSE;
627
        XClassHint class_hint = { NULL, NULL };
628
	gdk_error_trap_push ();
629
        if (XGetClassHint (GET_DISPLAY, window, &class_hint)) {
630
                if (g_strstr_len (class_hint.res_name,
631
                                  strlen (class_hint.res_name),
632
                                  "xvkbd"))
633
                        ret = TRUE;
634
        }
635
	if (G_UNLIKELY (gdk_error_trap_pop () == BadWindow)) ;
636
        return ret;
637
}
638
639
static void
640
setup_xvkbd_window (GSWindow *gswindow, Window window)
641
{
642
	xvkbd_window = gdk_window_foreign_new (window);
643
        gdk_window_hide (xvkbd_window);
644
        gdk_window_set_override_redirect (xvkbd_window, TRUE);
645
        gdk_window_set_events (xvkbd_window, gdk_window_get_events (xvkbd_window) | GDK_STRUCTURE_MASK);
646
       
647
        int display_width, display_height, width, height;
648
        GdkWindow *root = gdk_screen_get_root_window (gdk_drawable_get_screen (xvkbd_window));
649
       
650
        gdk_window_get_geometry (xvkbd_window, NULL, NULL, &width, &height, NULL);
651
        gdk_window_get_geometry (root, NULL, NULL, &display_width, &display_height, NULL);
652
        gdk_window_reparent (xvkbd_window, NULL, display_width - width, display_height - height);
653
        gdk_window_set_transient_for (xvkbd_window, GTK_WIDGET (gswindow)->window);
654
        gdk_window_show (xvkbd_window);
655
}
656
621
#ifdef HAVE_SHAPE_EXT
657
#ifdef HAVE_SHAPE_EXT
622
static void
658
static void
623
unshape_window (GSWindow *window)
659
unshape_window (GSWindow *window)
Lines 645-651 gs_window_xevent (GSWindow *window, Link Here
645
                        XMapEvent *xme = &ev->xmap;
703
                        XMapEvent *xme = &ev->xmap;
646
704
647
                        if (! x11_window_is_ours (xme->window)) {
705
                        if (! x11_window_is_ours (xme->window)) {
648
                                gs_window_raise (window);
706
                                if (is_xvkbd_window (xme->window))
707
                                        setup_xvkbd_window (window, xme->window);
708
                                else
709
                                        gs_window_raise (window);
649
                        } else {
710
                        } else {
650
                                gs_debug ("not raising our windows");
711
                                gs_debug ("not raising our windows");
651
                        }
712
                        }
Lines 657-663 gs_window_xevent (GSWindow *window, Link Here
657
                        XConfigureEvent *xce = &ev->xconfigure;
718
                        XConfigureEvent *xce = &ev->xconfigure;
658
719
659
                        if (! x11_window_is_ours (xce->window)) {
720
                        if (! x11_window_is_ours (xce->window)) {
660
                                gs_window_raise (window);
721
				gs_window_raise (window);
722
				gs_window_raise (xvkbd_window);
661
                        } else {
723
                        } else {
662
                                gs_debug ("not raising our windows");
724
                                gs_debug ("not raising our windows");
663
                        }
725
                        }

Return to bug 304399