summaryrefslogtreecommitdiff
path: root/src/ui/fixedtip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/fixedtip.c')
-rw-r--r--src/ui/fixedtip.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c
index a1bb410f..0a0418d3 100644
--- a/src/ui/fixedtip.c
+++ b/src/ui/fixedtip.c
@@ -21,6 +21,7 @@
#include <config.h>
#include "fixedtip.h"
+#include "meta-tooltip.h"
#include "ui.h"
/**
@@ -29,32 +30,6 @@
*/
static GtkWidget *tip = NULL;
-/**
- * The actual text that gets displayed.
- */
-static GtkWidget *label = NULL;
-
-static gboolean
-draw_handler (GtkWidget *widget,
- cairo_t *cr)
-{
- GtkStyleContext *context;
- gint width;
- gint height;
-
- if (widget == NULL)
- return FALSE;
-
- context = gtk_widget_get_style_context (widget);
- width = gtk_widget_get_allocated_width (widget);
- height = gtk_widget_get_allocated_height (widget);
-
- gtk_render_background (context, cr, 0, 0, width, height);
- gtk_render_frame (context, cr, 0, 0, width, height);
-
- return FALSE;
-}
-
void
meta_fixed_tip_show (int root_x, int root_y,
const char *markup_text)
@@ -70,34 +45,7 @@ meta_fixed_tip_show (int root_x, int root_y,
if (tip == NULL)
{
- GdkVisual *visual;
-
- tip = gtk_window_new (GTK_WINDOW_POPUP);
-
- gtk_window_set_type_hint (GTK_WINDOW(tip), GDK_WINDOW_TYPE_HINT_TOOLTIP);
- gtk_style_context_add_class (gtk_widget_get_style_context (tip),
- GTK_STYLE_CLASS_TOOLTIP);
-
- visual = gdk_screen_get_rgba_visual (screen);
-
- gtk_window_set_screen (GTK_WINDOW (tip), screen);
-
- if (visual != NULL)
- gtk_widget_set_visual (tip, visual);
-
- gtk_widget_set_app_paintable (tip, TRUE);
- gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
-
- g_signal_connect (tip, "draw", G_CALLBACK (draw_handler), NULL);
-
- label = gtk_label_new (NULL);
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
- gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
- gtk_widget_show (label);
-
- gtk_container_set_border_width (GTK_CONTAINER (tip), 4);
- gtk_container_add (GTK_CONTAINER (tip), label);
+ tip = meta_tooltip_new ();
g_signal_connect (tip, "destroy",
G_CALLBACK (gtk_widget_destroyed), &tip);
@@ -107,7 +55,7 @@ meta_fixed_tip_show (int root_x, int root_y,
gdk_screen_get_monitor_geometry (screen, mon_num, &monitor);
screen_right_edge = monitor.x + monitor.width;
- gtk_label_set_markup (GTK_LABEL (label), markup_text);
+ meta_tooltip_set_label_markup (META_TOOLTIP (tip), markup_text);
gtk_window_get_size (GTK_WINDOW (tip), &w, &h);