diff options
Diffstat (limited to 'pluma/pluma-notebook.c')
-rw-r--r-- | pluma/pluma-notebook.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/pluma/pluma-notebook.c b/pluma/pluma-notebook.c index 7a73397d..c792f4bb 100644 --- a/pluma/pluma-notebook.c +++ b/pluma/pluma-notebook.c @@ -100,7 +100,11 @@ enum static guint signals[LAST_SIGNAL] = { 0 }; static void +#if GTK_CHECK_VERSION (3, 0, 0) +pluma_notebook_dispose (GObject *object) +#else pluma_notebook_destroy (GtkObject *object) +#endif { PlumaNotebook *notebook = PLUMA_NOTEBOOK (object); @@ -120,19 +124,29 @@ pluma_notebook_destroy (GtkObject *object) notebook->priv->destroy_has_run = TRUE; } +#if GTK_CHECK_VERSION (3, 0, 0) + G_OBJECT_CLASS (pluma_notebook_parent_class)->dispose (object); +#else GTK_OBJECT_CLASS (pluma_notebook_parent_class)->destroy (object); +#endif } static void pluma_notebook_class_init (PlumaNotebookClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); +#if !GTK_CHECK_VERSION (3, 0, 0) GtkObjectClass *gtkobject_class = GTK_OBJECT_CLASS (klass); +#endif GtkNotebookClass *notebook_class = GTK_NOTEBOOK_CLASS (klass); object_class->finalize = pluma_notebook_finalize; +#if GTK_CHECK_VERSION (3, 0, 0) + object_class->dispose = pluma_notebook_dispose; +#else gtkobject_class->destroy = pluma_notebook_destroy; - +#endif + notebook_class->change_current_page = pluma_notebook_change_current_page; signals[TAB_ADDED] = @@ -247,10 +261,12 @@ find_tab_num_at_pos (PlumaNotebook *notebook, tab_pos = gtk_notebook_get_tab_pos (GTK_NOTEBOOK (notebook)); +#if !GTK_CHECK_VERSION (3, 0, 0) if (GTK_NOTEBOOK (notebook)->first_tab == NULL) { return AFTER_ALL_TABS; } +#endif /* For some reason unfullscreen + quick click can cause a wrong click event to be reported to the tab */ @@ -261,6 +277,7 @@ find_tab_num_at_pos (PlumaNotebook *notebook, while ((page = gtk_notebook_get_nth_page (nb, page_num)) != NULL) { + GtkAllocation allocation; GtkWidget *tab; gint max_x, max_y; gint x_root, y_root; @@ -268,17 +285,31 @@ find_tab_num_at_pos (PlumaNotebook *notebook, tab = gtk_notebook_get_tab_label (nb, page); g_return_val_if_fail (tab != NULL, AFTER_ALL_TABS); +#if GTK_CHECK_VERSION (3, 0, 0) + if (!gtk_widget_get_mapped (tab)) +#else if (!GTK_WIDGET_MAPPED (GTK_WIDGET (tab))) +#endif { ++page_num; continue; } +#if GTK_CHECK_VERSION (3, 0, 0) + gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window (tab)), +#else gdk_window_get_origin (GDK_WINDOW (tab->window), +#endif &x_root, &y_root); - max_x = x_root + tab->allocation.x + tab->allocation.width; - max_y = y_root + tab->allocation.y + tab->allocation.height; +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_allocation(tab, &allocation); +#else + allocation = tab->allocation; +#endif + + max_x = x_root + allocation.x + allocation.width; + max_y = y_root + allocation.y + allocation.height; if (((tab_pos == GTK_POS_TOP) || (tab_pos == GTK_POS_BOTTOM)) && @@ -658,7 +689,11 @@ pluma_notebook_new (void) static void pluma_notebook_switch_page_cb (GtkNotebook *notebook, +#if GTK_CHECK_VERSION (3, 0, 0) + GtkWidget *page, +#else GtkNotebookPage *page, +#endif guint page_num, gpointer data) { |