Skip to content

Commit

Permalink
fixup! set-cursor-location-relative
Browse files Browse the repository at this point in the history
  • Loading branch information
rtcm committed Feb 12, 2016
1 parent 6c9d8ac commit bb9f34d
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions client/gtk2/ibusimcontext.c
Expand Up @@ -30,6 +30,10 @@
#include <ibus.h>
#include "ibusimcontext.h"

#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif

#if !GTK_CHECK_VERSION (2, 91, 0)
# define DEPRECATED_GDK_KEYSYMS 1
#endif
Expand Down Expand Up @@ -1011,11 +1015,28 @@ _set_cursor_location_internal (IBusIMContext *ibusimcontext)
}

area = ibusimcontext->cursor_area;
ibus_input_context_set_cursor_location_relative (ibusimcontext->ibuscontext,
area.x,
area.y,
area.width,
area.height);

#ifdef GDK_WINDOWING_WAYLAND
if (GDK_IS_WAYLAND_DISPLAY (gdk_display_get_default ())) {
gdouble px, py;
GdkWindow *parent;
GdkWindow *window = ibusimcontext->client_window;

while ((parent = gdk_window_get_effective_parent (window)) != NULL) {
gdk_window_coords_to_parent (window, area.x, area.y, &px, &py);
area.x = px;
area.y = py;
window = parent;
}

ibus_input_context_set_cursor_location_relative (ibusimcontext->ibuscontext,
area.x,
area.y,
area.width,
area.height);
return FALSE;
}
#endif

if (area.x == -1 && area.y == -1 && area.width == 0 && area.height == 0) {
#if GTK_CHECK_VERSION (2, 91, 0)
Expand Down

0 comments on commit bb9f34d

Please sign in to comment.