From a2ddfbb6f1d52b03aa221ce433a04062f6de6634 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Tue, 6 Sep 2011 13:52:37 -0400 Subject: Ok I take it back we don't care about border. use custom css to set border-width and radius --- src/idooffscreenproxy.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/idooffscreenproxy.c b/src/idooffscreenproxy.c index ba5a295..50a087d 100644 --- a/src/idooffscreenproxy.c +++ b/src/idooffscreenproxy.c @@ -168,6 +168,19 @@ ido_offscreen_proxy_create_alpha_image_surface (GdkWindow *offscreen, gint width return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); } +static void +proxy_add_css (GtkStyleContext *sc) +{ + GtkCssProvider *provider = gtk_css_provider_new(); + const gchar *proxy_css = ".menu.ido-offscreen { \nborder-width: 0;\nborder-radius:0; \n}\n"; + + gtk_css_provider_load_from_data (provider, proxy_css, -1, NULL); + + gtk_style_context_add_provider (sc, GTK_STYLE_PROVIDER (provider), + GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); + +} + static void ido_offscreen_proxy_realize (GtkWidget *widget) { @@ -244,7 +257,10 @@ ido_offscreen_proxy_realize (GtkWidget *widget) gtk_style_context_set_background (context, window); gtk_style_context_set_background (context, proxy->priv->offscreen_window); gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM | GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT); - + + gtk_widget_set_name (widget, "IdoOffscreenProxy"); + gtk_widget_path_iter_set_name (gtk_widget_get_path (widget), -1, "IdoOffscreenProxy"); + gdk_window_show (proxy->priv->offscreen_window); } @@ -436,9 +452,14 @@ get_menu_style_context () gtk_widget_path_append_type (path, GTK_TYPE_MENU); sc = gtk_style_context_new(); + + proxy_add_css (sc); gtk_style_context_set_path (sc, path); gtk_style_context_add_class (sc, GTK_STYLE_CLASS_MENU); + gtk_style_context_add_class (sc, "ido-offscreen"); + + gtk_widget_path_free (path); @@ -451,19 +472,16 @@ ido_offscreen_proxy_draw (GtkWidget *widget, { IdoOffscreenProxy *proxy = IDO_OFFSCREEN_PROXY (widget); GdkWindow *window; - GtkStyleContext *sc, *wsc; - GtkBorder border; + GtkStyleContext *sc; window = gtk_widget_get_window (widget); sc = get_menu_style_context(); - wsc = gtk_widget_get_style_context (widget); - gtk_style_context_get_border (wsc, gtk_widget_get_state (widget), &border); gtk_render_background (sc, cr, - -border.left,-border.top, - gdk_window_get_width (window) + border.right*2, - gdk_window_get_height (window) + border.bottom*2); + 0, 0, + gdk_window_get_width (window), + gdk_window_get_height (window)); g_object_unref (sc); -- cgit v1.2.3