[geany/geany] b58995: Don't access private field GtkNotebook::event_window

Colomban Wendling git-noreply at xxxxx
Sat Sep 15 22:26:43 UTC 2012


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Sat, 15 Sep 2012 22:26:43
Commit:      b58995c9fc8c183ef37a31ca74ba44336a6c55ce
             https://github.com/geany/geany/commit/b58995c9fc8c183ef37a31ca74ba44336a6c55ce

Log Message:
-----------
Don't access private field GtkNotebook::event_window


Modified Paths:
--------------
    src/notebook.c

Modified: src/notebook.c
13 files changed, 9 insertions(+), 4 deletions(-)
===================================================================
@@ -506,12 +506,17 @@ static gboolean notebook_tab_bar_click_cb(GtkWidget *widget, GdkEventButton *eve
 {
 	if (event->type == GDK_2BUTTON_PRESS)
 	{
-		/* accessing ::event_window is a little hacky but we need to make sure the click
-		 * was in the tab bar and not inside the child */
-		if (event->window != GTK_NOTEBOOK(main_widgets.notebook)->event_window)
+		GtkNotebook *notebook = GTK_NOTEBOOK(widget);
+		GtkWidget *event_widget = gtk_get_event_widget((GdkEvent *) event);
+		GtkWidget *child = gtk_notebook_get_nth_page(notebook, gtk_notebook_get_current_page(notebook));
+
+		/* ignore events from the content of the page (impl. stolen from GTK2 tab scrolling)
+		 * TODO: we should also ignore notebook's action widgets, but that's more work and
+		 * we don't have any of them yet anyway -- and GTK 2.16 don't have those actions. */
+		if (event_widget == NULL || event_widget == child || gtk_widget_is_ancestor(event_widget, child))
 			return FALSE;
 
-		if (is_position_on_tab_bar(GTK_NOTEBOOK(widget), event))
+		if (is_position_on_tab_bar(notebook, event))
 		{
 			document_new_file(NULL, NULL, NULL);
 			return TRUE;


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Commits mailing list