|
Lines 647-652
x11_window_is_ours (Window window)
Link Here
|
| 647 |
return ret; |
647 |
return ret; |
| 648 |
} |
648 |
} |
| 649 |
|
649 |
|
|
|
650 |
#define GET_DISPLAY gdk_x11_display_get_xdisplay (gdk_display_get_default ()) |
| 651 |
|
| 652 |
GdkWindow *xvkbd_window = NULL; |
| 653 |
|
| 654 |
static gboolean |
| 655 |
is_xvkbd_window (Window window) |
| 656 |
{ |
| 657 |
gboolean ret = FALSE; |
| 658 |
XClassHint class_hint = { NULL, NULL }; |
| 659 |
|
| 660 |
gdk_error_trap_push (); |
| 661 |
if (XGetClassHint (GET_DISPLAY, window, &class_hint)) { |
| 662 |
if (g_strstr_len (class_hint.res_name, |
| 663 |
strlen (class_hint.res_name), |
| 664 |
"xvkbd")) |
| 665 |
ret = TRUE; |
| 666 |
} |
| 667 |
|
| 668 |
if (G_UNLIKELY (gdk_error_trap_pop () == BadWindow)) ; |
| 669 |
|
| 670 |
return ret; |
| 671 |
} |
| 672 |
|
| 673 |
static void |
| 674 |
setup_xvkbd_window (GSWindow *gswindow, Window window) |
| 675 |
{ |
| 676 |
gs_debug ("Setting up xvkbd_window from window %d", (int) window); |
| 677 |
|
| 678 |
xvkbd_window = gdk_window_foreign_new (window); |
| 679 |
gdk_window_hide (xvkbd_window); |
| 680 |
gdk_window_set_override_redirect (xvkbd_window, TRUE); |
| 681 |
gdk_window_set_events (xvkbd_window, gdk_window_get_events (xvkbd_window) | GDK_STRUCTURE_MASK); |
| 682 |
|
| 683 |
int display_width, display_height, width, height; |
| 684 |
GdkWindow *root = gdk_screen_get_root_window (gdk_drawable_get_screen (xvkbd_window)); |
| 685 |
|
| 686 |
gdk_window_get_geometry (xvkbd_window, NULL, NULL, &width, &height, NULL); |
| 687 |
gdk_window_get_geometry (root, NULL, NULL, &display_width, &display_height, NULL); |
| 688 |
gdk_window_reparent (xvkbd_window, NULL, display_width - width, display_height - height); |
| 689 |
gdk_window_set_transient_for (xvkbd_window, GTK_WIDGET (gswindow)->window); |
| 690 |
gdk_window_show (xvkbd_window); |
| 691 |
} |
| 692 |
|
| 650 |
#ifdef HAVE_SHAPE_EXT |
693 |
#ifdef HAVE_SHAPE_EXT |
| 651 |
static void |
694 |
static void |
| 652 |
unshape_window (GSWindow *window) |
695 |
unshape_window (GSWindow *window) |
|
Lines 669-674
gs_window_xevent (GSWindow *window,
Link Here
|
| 669 |
/* MapNotify is used to tell us when new windows are mapped. |
712 |
/* MapNotify is used to tell us when new windows are mapped. |
| 670 |
ConfigureNofify is used to tell us when windows are raised. */ |
713 |
ConfigureNofify is used to tell us when windows are raised. */ |
| 671 |
switch (ev->xany.type) { |
714 |
switch (ev->xany.type) { |
|
|
715 |
case CreateNotify : |
| 716 |
{ |
| 717 |
XCreateWindowEvent *create_event; |
| 718 |
|
| 719 |
create_event = &ev->xcreatewindow; |
| 720 |
if (!x11_window_is_ours (create_event->window) && is_xvkbd_window (create_event->window)) |
| 721 |
setup_xvkbd_window (window, create_event->window); |
| 722 |
|
| 723 |
break; |
| 724 |
} |
| 672 |
case MapNotify: |
725 |
case MapNotify: |
| 673 |
{ |
726 |
{ |
| 674 |
XMapEvent *xme = &ev->xmap; |
727 |
XMapEvent *xme = &ev->xmap; |
|
Lines 686-692
gs_window_xevent (GSWindow *window,
Link Here
|
| 686 |
XConfigureEvent *xce = &ev->xconfigure; |
739 |
XConfigureEvent *xce = &ev->xconfigure; |
| 687 |
|
740 |
|
| 688 |
if (! x11_window_is_ours (xce->window)) { |
741 |
if (! x11_window_is_ours (xce->window)) { |
| 689 |
gs_window_raise (window); |
742 |
gs_window_raise (window); |
| 690 |
} else { |
743 |
} else { |
| 691 |
gs_debug ("not raising our windows"); |
744 |
gs_debug ("not raising our windows"); |
| 692 |
} |
745 |
} |