From f6490769c12dbb3b7766c7e6861284b8fee9f9e6 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 21 Dec 2018 20:57:07 +0100 Subject: Improved view switching. --- src/gtkext/gtkgraphdisplay.c | 17 +++++++++++++---- src/gui/menus/view.c | 15 --------------- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/gtkext/gtkgraphdisplay.c b/src/gtkext/gtkgraphdisplay.c index 4475c08..749a156 100644 --- a/src/gtkext/gtkgraphdisplay.c +++ b/src/gtkext/gtkgraphdisplay.c @@ -650,17 +650,20 @@ static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *display, const { gtk_graph_display_reset(display, false); + if (!g_line_cursor_is_valid(cursor)) + goto no_valid_cursor; + format = g_loaded_binary_get_format(GTK_DISPLAY_PANEL(display)->binary); found = g_binary_format_find_symbol_for(G_BIN_FORMAT(format), &addr, &symbol); if (!found) - goto ggddma_done; + goto no_symbol_found; type = g_binary_symbol_get_target_type(symbol); if (type != STP_ROUTINE && type != STP_ENTRY_POINT) - goto ggddma_bad_type; + goto bad_symbol_type; display->routine = symbol; g_object_ref(G_OBJECT(symbol)); @@ -694,6 +697,8 @@ static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *display, const gtk_graph_display_update_support_margins(display, &allocation); + gtk_widget_size_allocate(GTK_WIDGET(display), &allocation); + /** * Première sélection... */ @@ -704,16 +709,20 @@ static void gtk_graph_display_prepare_for_cursor(GtkGraphDisplay *display, const g_object_unref(G_OBJECT(child)); - ggddma_bad_type: + bad_symbol_type: g_object_unref(G_OBJECT(symbol)); - ggddma_done: + no_symbol_found: update_editor_items_current_view(G_LOADED_PANEL(display)); g_object_unref(G_OBJECT(format)); + no_valid_cursor: + + ; + } } diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index 6bbd484..255f1d9 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -759,8 +759,6 @@ static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *menuitem, gpointer static void handle_loaded_panel_first_allocation(GtkWidget *widget, GdkRectangle *alloc, GLineCursor *cursor) { - GtkAllocation allocation; /* Emplacement effectif */ - /* On ne réagit que la première fois */ g_signal_handlers_disconnect_by_func(widget, G_CALLBACK(handle_loaded_panel_first_allocation), cursor); @@ -768,19 +766,6 @@ static void handle_loaded_panel_first_allocation(GtkWidget *widget, GdkRectangle g_object_unref(G_OBJECT(cursor)); - /** - * Pour les mêmes raisons que celles exposées dans change_current_view_support(), - * l'affichage en vue graphique n'est pas centré initialement. - * - * On profite donc de ce crochet pour corriger le tir ! - */ - - if (GTK_IS_GRAPH_DISPLAY(widget)) - { - gtk_widget_get_allocation(widget, &allocation); - gtk_widget_size_allocate(widget, &allocation); - } - } -- cgit v0.11.2-87-g4458