summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-21 19:57:07 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-21 19:57:07 (GMT)
commitf6490769c12dbb3b7766c7e6861284b8fee9f9e6 (patch)
tree2536b536a800c5087022c78d4ea88c4d8d841c56
parent365246bd2d9dd9f7eea008b25b8550bba0aac1cc (diff)
Improved view switching.
-rw-r--r--src/gtkext/gtkgraphdisplay.c17
-rw-r--r--src/gui/menus/view.c15
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);
- }
-
}