Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "config.h"
- #include <gtk/gtk.h>
- #include "gtklabelclickable.h"
- static GdkWindow *
- gtk_label_create_window (GtkWidget *widget)
- {
- GdkWindow *retval;
- GdkWindowAttr attributes;
- gint attributes_mask;
- g_assert (GTK_WIDGET_REALIZED (widget));
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.wclass = GDK_INPUT_ONLY;
- attributes.override_redirect = TRUE;
- attributes.event_mask = gtk_widget_get_events (widget) |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_NOREDIR;
- /*
- attributes.cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
- GDK_XTERM);
- attributes_mask |= GDK_WA_CURSOR;
- */
- retval = gdk_window_new (widget->window, &attributes, attributes_mask);
- gdk_window_set_user_data (retval, widget);
- GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
- gdk_window_show (retval);
- return retval;
- }
- /* TODO, hook up map and unmap */
- static void
- label_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation,
- gpointer userdata)
- {
- gdk_window_move_resize ( GDK_WINDOW(userdata),
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
- static void
- label_realize (GtkWidget *widget,
- gpointer userdata)
- {
- GdkWindow *window;
- window = gtk_label_create_window (widget);
- g_signal_connect_after (widget, "size_allocate", G_CALLBACK(label_size_allocate), window);
- }
- void MyGtkLabelClickable(GtkLabel *label)
- {
- g_signal_connect_after (label, "realize", G_CALLBACK(label_realize), NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement