[gnome-shell/wip/wayland: 158/160] StEntry: don't call ClutterX11 methods if Clutter is not using x11



commit b963b1bb2ba0adde51a31041d00947813b7f7c5a
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Aug 13 17:05:27 2013 +0200

    StEntry: don't call ClutterX11 methods if Clutter is not using x11
    
    It causes an assert and crashes.

 src/shell-global.c  |    1 +
 src/st/st-entry.c   |    3 +++
 src/st/st-im-text.c |   13 +++++++++++++
 src/st/st-im-text.h |    2 ++
 4 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index f538506..f2ec992 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -956,6 +956,7 @@ _shell_global_set_plugin (ShellGlobal *global,
                                                  &attributes,
                                                  0 /* attributes_mask */);
       global->stage_xwindow = gdk_x11_window_get_xid (global->stage_gdk_window);
+      st_im_text_set_fake_window (global->stage_gdk_window);
     }
   else
 #endif
diff --git a/src/st/st-entry.c b/src/st/st-entry.c
index 6aa4dc3..07f1414 100644
--- a/src/st/st-entry.c
+++ b/src/st/st-entry.c
@@ -686,6 +686,9 @@ st_entry_set_cursor (StEntry  *entry,
   Window wid;
   static Cursor ibeam = None;
 
+  if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
+    return;
+
   dpy = clutter_x11_get_default_display ();
   stage = clutter_actor_get_stage (actor);
 
diff --git a/src/st/st-im-text.c b/src/st/st-im-text.c
index ff110f1..b916c65 100644
--- a/src/st/st-im-text.c
+++ b/src/st/st-im-text.c
@@ -203,6 +203,9 @@ st_im_text_get_paint_volume (ClutterActor       *self,
   return clutter_paint_volume_set_from_allocation (volume, self);
 }
 
+
+static GdkWindow *fake_window;
+
 /* Returns a new reference to window */
 static GdkWindow *
 window_for_actor (ClutterActor *actor)
@@ -212,7 +215,11 @@ window_for_actor (ClutterActor *actor)
   Window xwindow;
   GdkWindow *window;
 
+  if (fake_window != NULL)
+    return g_object_ref (fake_window);
+
   stage = clutter_actor_get_stage (actor);
+
   xwindow = clutter_x11_get_stage_window ((ClutterStage *)stage);
 
   window = gdk_x11_window_lookup_for_display (display, xwindow);
@@ -224,6 +231,12 @@ window_for_actor (ClutterActor *actor)
   return window;
 }
 
+void
+st_im_text_set_fake_window (GdkWindow *fake)
+{
+  fake_window = fake;
+}
+
 static void
 st_im_text_realize (ClutterActor *actor)
 {
diff --git a/src/st/st-im-text.h b/src/st/st-im-text.h
index e675c34..061d420 100644
--- a/src/st/st-im-text.h
+++ b/src/st/st-im-text.h
@@ -68,6 +68,8 @@ void            st_im_text_set_input_hints   (StIMText       *imtext,
                                               GtkInputHints   hints);
 GtkInputHints   st_im_text_get_input_hints   (StIMText       *imtext);
 
+void            st_im_text_set_fake_window   (GdkWindow      *fake);
+
 G_END_DECLS
 
 #endif /* __ST_IM_TEXT_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]