|
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 |
} |