Add ::draw handler for GTK3 where we have ::expose-event handlers

This commit is contained in:
Colomban Wendling 2012-09-16 00:10:24 +02:00
parent fa5a00b48b
commit c5985f0cd1
3 changed files with 32 additions and 0 deletions

View File

@ -4625,6 +4625,14 @@ static gboolean on_editor_expose_event(GtkWidget *widget, GdkEventExpose *event,
} }
#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean on_editor_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
return on_editor_expose_event(widget, NULL, user_data);
}
#endif
static void setup_sci_keys(ScintillaObject *sci) static void setup_sci_keys(ScintillaObject *sci)
{ {
/* disable some Scintilla keybindings to be able to redefine them cleanly */ /* disable some Scintilla keybindings to be able to redefine them cleanly */
@ -4710,7 +4718,11 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
g_signal_connect(sci, "scroll-event", G_CALLBACK(on_editor_scroll_event), editor); g_signal_connect(sci, "scroll-event", G_CALLBACK(on_editor_scroll_event), editor);
g_signal_connect(sci, "motion-notify-event", G_CALLBACK(on_motion_event), NULL); g_signal_connect(sci, "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
g_signal_connect(sci, "focus-in-event", G_CALLBACK(on_editor_focus_in), editor); g_signal_connect(sci, "focus-in-event", G_CALLBACK(on_editor_focus_in), editor);
#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect(sci, "draw", G_CALLBACK(on_editor_draw), editor);
#else
g_signal_connect(sci, "expose-event", G_CALLBACK(on_editor_expose_event), editor); g_signal_connect(sci, "expose-event", G_CALLBACK(on_editor_expose_event), editor);
#endif
} }
return sci; return sci;
} }

View File

@ -1068,6 +1068,14 @@ static gboolean on_menu_expose_event(GtkWidget *widget, GdkEventExpose *event,
} }
#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean on_menu_draw(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
return on_menu_expose_event(widget, NULL, user_data);
}
#endif
static gboolean set_sensitive(gpointer widget) static gboolean set_sensitive(gpointer widget)
{ {
gtk_widget_set_sensitive(GTK_WIDGET(widget), TRUE); gtk_widget_set_sensitive(GTK_WIDGET(widget), TRUE);
@ -1112,7 +1120,11 @@ static gboolean check_vte(GdkModifierType state, guint keyval)
/* make the menubar sensitive before it is redrawn */ /* make the menubar sensitive before it is redrawn */
static gboolean connected = FALSE; static gboolean connected = FALSE;
if (!connected) if (!connected)
#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect(widget, "draw", G_CALLBACK(on_menu_draw), NULL);
#else
g_signal_connect(widget, "expose-event", G_CALLBACK(on_menu_expose_event), NULL); g_signal_connect(widget, "expose-event", G_CALLBACK(on_menu_expose_event), NULL);
#endif
} }
widget = main_widgets.editor_menu; widget = main_widgets.editor_menu;

View File

@ -588,16 +588,24 @@ void sidebar_add_common_menu_items(GtkMenu *menu)
item = gtk_check_menu_item_new_with_mnemonic(_("Show S_ymbol List")); item = gtk_check_menu_item_new_with_mnemonic(_("Show S_ymbol List"));
gtk_container_add(GTK_CONTAINER(menu), item); gtk_container_add(GTK_CONTAINER(menu), item);
#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect(item, "draw", G_CALLBACK(on_sidebar_display_symbol_list_show), NULL);
#else
g_signal_connect(item, "expose-event", g_signal_connect(item, "expose-event",
G_CALLBACK(on_sidebar_display_symbol_list_show), NULL); G_CALLBACK(on_sidebar_display_symbol_list_show), NULL);
#endif
gtk_widget_show(item); gtk_widget_show(item);
g_signal_connect(item, "activate", g_signal_connect(item, "activate",
G_CALLBACK(on_list_symbol_activate), NULL); G_CALLBACK(on_list_symbol_activate), NULL);
item = gtk_check_menu_item_new_with_mnemonic(_("Show _Document List")); item = gtk_check_menu_item_new_with_mnemonic(_("Show _Document List"));
gtk_container_add(GTK_CONTAINER(menu), item); gtk_container_add(GTK_CONTAINER(menu), item);
#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect(item, "draw", G_CALLBACK(on_sidebar_display_open_files_show), NULL);
#else
g_signal_connect(item, "expose-event", g_signal_connect(item, "expose-event",
G_CALLBACK(on_sidebar_display_open_files_show), NULL); G_CALLBACK(on_sidebar_display_open_files_show), NULL);
#endif
gtk_widget_show(item); gtk_widget_show(item);
g_signal_connect(item, "activate", g_signal_connect(item, "activate",
G_CALLBACK(on_list_document_activate), NULL); G_CALLBACK(on_list_document_activate), NULL);