]> Pileus Git - ~andy/gtk/blobdiff - modules/input/gtkimcontextxim.c
Don't rotate pdf landscape output
[~andy/gtk] / modules / input / gtkimcontextxim.c
index 612a8cee73c55b21917165207675b221660da615..1a32e5abfd5671efb4bed7e9e354567381c964ec 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "config.h"
@@ -327,25 +325,6 @@ setup_im (GtkXIMInfo *info)
                NULL);
 
   info->settings = gtk_settings_get_for_screen (info->screen);
-
-  if (!g_object_class_find_property (G_OBJECT_GET_CLASS (info->settings),
-                                    "gtk-im-preedit-style"))
-    gtk_settings_install_property (g_param_spec_enum ("gtk-im-preedit-style",
-                                                     P_("IM Preedit style"),
-                                                     P_("How to draw the input method preedit string"),
-                                                     GTK_TYPE_IM_PREEDIT_STYLE,
-                                                     GTK_IM_PREEDIT_CALLBACK,
-                                                     G_PARAM_READWRITE));
-
-  if (!g_object_class_find_property (G_OBJECT_GET_CLASS (info->settings),
-                                    "gtk-im-status-style"))
-    gtk_settings_install_property (g_param_spec_enum ("gtk-im-status-style",
-                                                     P_("IM Status style"),
-                                                     P_("How to draw the input method statusbar"),
-                                                     GTK_TYPE_IM_STATUS_STYLE,
-                                                     GTK_IM_STATUS_CALLBACK,
-                                                     G_PARAM_READWRITE));
-
   info->status_set = g_signal_connect_swapped (info->settings,
                                               "notify::gtk-im-status-style",
                                               G_CALLBACK (status_style_change),
@@ -669,6 +648,8 @@ gtk_im_context_xim_new (void)
   GtkIMContextXIM *result;
   const gchar *charset;
 
+  if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
+    return NULL;
   result = g_object_new (GTK_TYPE_IM_CONTEXT_XIM, NULL);
 
   result->locale = g_strdup (setlocale (LC_CTYPE, NULL));
@@ -726,9 +707,9 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   xevent.type = (event->type == GDK_KEY_PRESS) ? KeyPress : KeyRelease;
   xevent.serial = 0;           /* hope it doesn't matter */
   xevent.send_event = event->send_event;
-  xevent.display = GDK_DRAWABLE_XDISPLAY (event->window);
-  xevent.window = GDK_DRAWABLE_XID (event->window);
-  xevent.root = GDK_DRAWABLE_XID (root_window);
+  xevent.display = GDK_WINDOW_XDISPLAY (event->window);
+  xevent.window = GDK_WINDOW_XID (event->window);
+  xevent.root = GDK_WINDOW_XID (root_window);
   xevent.subwindow = xevent.window;
   xevent.time = event->time;
   xevent.x = xevent.x_root = 0;
@@ -737,7 +718,7 @@ gtk_im_context_xim_filter_keypress (GtkIMContext *context,
   xevent.keycode = event->hardware_keycode;
   xevent.same_screen = True;
   
-  if (XFilterEvent ((XEvent *)&xevent, GDK_DRAWABLE_XID (context_xim->client_window)))
+  if (XFilterEvent ((XEvent *)&xevent, GDK_WINDOW_XID (context_xim->client_window)))
     return TRUE;
   
   if (event->state &
@@ -1453,7 +1434,7 @@ gtk_im_context_xim_get_ic (GtkIMContextXIM *context_xim)
 
       xic = XCreateIC (context_xim->im_info->im,
                       XNInputStyle, im_style,
-                      XNClientWindow, GDK_DRAWABLE_XID (context_xim->client_window),
+                      XNClientWindow, GDK_WINDOW_XID (context_xim->client_window),
                       name1, list1,
                       name2, list2,
                       NULL);
@@ -1695,7 +1676,7 @@ on_status_toplevel_configure (GtkWidget         *toplevel,
 
       gdk_window_get_frame_extents (gtk_widget_get_window (toplevel),
                                     &rect);
-      gtk_size_request_get_size (GTK_SIZE_REQUEST (status_window->window),
+      gtk_widget_get_preferred_size ( (status_window->window),
                                  &requisition, NULL);
 
       if (rect.y + rect.height + requisition.height < height)
@@ -1774,14 +1755,19 @@ static gboolean
 on_status_window_draw (GtkWidget *widget,
                        cairo_t   *cr)
 {
-  GtkStyle *style;
+  GtkStyleContext *style;
+  GdkRGBA color;
 
-  style = gtk_widget_get_style (widget);
+  style = gtk_widget_get_style_context (widget);
 
-  gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+  gtk_style_context_get_background_color (style, 0, &color);
+  gdk_cairo_set_source_rgba (cr, &color);
+  cairo_paint (cr);
+
+  gtk_style_context_get_color (style, 0, &color);
+  gdk_cairo_set_source_rgba (cr, &color);
   cairo_paint (cr);
 
-  gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
   cairo_rectangle (cr, 
                    0, 0,
                    gtk_widget_get_allocated_width (widget) - 1,
@@ -1791,26 +1777,6 @@ on_status_window_draw (GtkWidget *widget,
   return FALSE;
 }
 
-/* We watch the ::style-set signal for our label widget
- * and use that to change it's foreground color to match
- * the 'text' color of the toplevel window. The text/base
- * pair of colors might be reversed from the fg/bg pair
- * that are normally used for labels.
- */
-static void
-on_status_window_style_set (GtkWidget *toplevel,
-                           GtkStyle  *previous_style,
-                           GtkWidget *label)
-{
-  GtkStyle *style;
-  gint i;
-
-  style = gtk_widget_get_style (toplevel);
-
-  for (i = 0; i < 5; i++)
-    gtk_widget_modify_fg (label, i, &style->text[i]);
-}
-
 /* Creates the widgets for the status window; called when we
  * first need to show text for the status window.
  */
@@ -1827,11 +1793,9 @@ status_window_make_window (StatusWindow *status_window)
   gtk_widget_set_app_paintable (window, TRUE);
 
   status_label = gtk_label_new ("");
-  gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
+  g_object_set (status_label, "margin", 1, NULL);
   gtk_widget_show (status_label);
   
-  g_signal_connect (window, "style-set",
-                   G_CALLBACK (on_status_window_style_set), status_label);
   gtk_container_add (GTK_CONTAINER (window), status_label);
   
   g_signal_connect (window, "draw",