imcontextxim: Fix showing glyph in status window

This custom drawing code was broken, which meant the current mode
indicator/character did not show, severely hindering XIM users.

Fix by simply removing the custom drawing and just being a GtkWindow, by
cherry-picking these two from GTK+ 3:
  commit 211ccb5c73
  commit c750cea4e57ed3bcb5ba7eada95d0be380aa2fe5t

https://bugzilla.gnome.org/show_bug.cgi?id=696624
This commit is contained in:
Daniel Boles
2017-09-02 12:18:07 +01:00
parent b7e5da4cd4
commit bc555cd64f

View File

@@ -1747,48 +1747,6 @@ status_window_get (GtkWidget *toplevel)
return status_window;
}
/* Draw the background (normally white) and border for the status window
*/
static gboolean
on_status_window_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
cairo_t *cr;
cr = gdk_cairo_create (widget->window);
gdk_cairo_set_source_color (cr, &widget->style->base[GTK_STATE_NORMAL]);
cairo_rectangle (cr,
0, 0,
widget->allocation.width, widget->allocation.height);
cairo_fill (cr);
gdk_cairo_set_source_color (cr, &widget->style->text[GTK_STATE_NORMAL]);
cairo_rectangle (cr,
0, 0,
widget->allocation.width - 1, widget->allocation.height - 1);
cairo_fill (cr);
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)
{
gint i;
for (i = 0; i < 5; i++)
gtk_widget_modify_fg (label, i, &toplevel->style->text[i]);
}
/* Creates the widgets for the status window; called when we
* first need to show text for the status window.
*/
@@ -1802,19 +1760,13 @@ status_window_make_window (StatusWindow *status_window)
window = status_window->window;
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_widget_set_app_paintable (window, TRUE);
status_label = gtk_label_new ("");
gtk_misc_set_padding (GTK_MISC (status_label), 1, 1);
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, "expose-event",
G_CALLBACK (on_status_window_expose_event), NULL);
gtk_window_set_screen (GTK_WINDOW (status_window->window),
gtk_widget_get_screen (status_window->toplevel));