From: compudj Date: Sun, 8 Aug 2004 06:52:52 +0000 (+0000) Subject: Focus works X-Git-Tag: v0.12.20~2815 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f37a2002e940e771ef47c9936f9b82b79e64d086;p=lttv.git Focus works git-svn-id: http://ltt.polymtl.ca/svn@674 04897980-b3bd-0310-b5e0-8ef037075253 --- diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c index ba53e288..ba15e15c 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c @@ -29,16 +29,6 @@ extern GSList *g_control_flow_data_list; -static void control_flow_grab_focus(GtkWidget *widget, gpointer data){ - ControlFlowData * control_flow_data = (ControlFlowData *)data; - Tab * tab = control_flow_data->tab; - lttvwindow_report_focus(tab, guicontrolflow_get_widget(control_flow_data)); - //g_assert(GTK_WIDGET_CAN_FOCUS(widget)); - //gtk_widget_grab_focus(widget); - g_debug("FOCUS GRABBED"); -} - - static gboolean header_size_allocate(GtkWidget *widget, GtkAllocation *allocation, @@ -152,11 +142,6 @@ guicontrolflow(void) //can be configured (and this must happend bedore sending //data) - //g_signal_connect (G_OBJECT (process_list_widget), "grab-focus", - //g_signal_connect (G_OBJECT (control_flow_data->scrolled_window), - // "button-press-event", - // G_CALLBACK (control_flow_grab_focus), - // control_flow_data); return control_flow_data; diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c index 8ef1b430..38578cfc 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c @@ -487,9 +487,6 @@ button_press_event( GtkWidget *widget, GdkEventButton *event, gpointer user_data } - lttvwindow_report_focus(control_flow_data->tab, - gtk_widget_get_parent(guicontrolflow_get_widget(control_flow_data))); - return FALSE; } @@ -520,11 +517,9 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data) drawing->ruler_hbox = gtk_hbox_new(FALSE, 1); drawing->ruler = gtk_drawing_area_new (); - gtk_widget_add_events(drawing->ruler, GDK_BUTTON_PRESS_MASK); //gtk_widget_set_size_request(drawing->ruler, -1, 27); drawing->padding = gtk_drawing_area_new (); - gtk_widget_add_events(drawing->padding, GDK_BUTTON_PRESS_MASK); //gtk_widget_set_size_request(drawing->padding, -1, 27); gtk_box_pack_start(GTK_BOX(drawing->ruler_hbox), drawing->ruler, TRUE, TRUE, 0); @@ -613,8 +608,6 @@ Drawing_t *drawing_construct(ControlFlowData *control_flow_data) // drawing->drawing_area->allocation.height, // -1); - gtk_widget_add_events(drawing->drawing_area, GDK_BUTTON_PRESS_MASK); - g_signal_connect (G_OBJECT(drawing->drawing_area), "configure_event", G_CALLBACK (configure_event), diff --git a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c index 5b7d22b3..13c1e296 100644 --- a/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c +++ b/ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c @@ -567,6 +567,11 @@ int draw_before_hook(void *hook_data, void *call_data) } } } + } else if(strcmp( + ltt_eventtype_name(ltt_event_eventtype(e)),"process") == 0) { + /* We are in a fork or exit event */ + + } @@ -1290,7 +1295,13 @@ int draw_after_hook(void *hook_data, void *call_data) width, &hashed_process_data_in->x); } + } else if(strcmp( + ltt_eventtype_name(ltt_event_eventtype(e)),"process") == 0) { + /* We are in a fork or exit event */ + + } + return 0; diff --git a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c index f18727ab..38030ba8 100644 --- a/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c +++ b/ltt/branches/poly/lttv/modules/gui/detailedevents/events.c @@ -175,7 +175,6 @@ static void tree_v_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gp static void tree_v_size_request_cb (GtkWidget *widget, GtkRequisition *requisition, gpointer data); static void tree_v_cursor_changed_cb (GtkWidget *widget, gpointer data); static void tree_v_move_cursor_cb (GtkWidget *widget, GtkMovementStep arg1, gint arg2, gpointer data); -static void tree_v_grab_focus(GtkWidget *widget, gpointer data); static void get_data(double time, guint list_height, @@ -217,7 +216,6 @@ GtkWidget * h_gui_events(Tab * tab, LttvTracesetSelector * s, char* key) { EventViewerData* event_viewer_data = gui_events(tab, s, key) ; - if(event_viewer_data) return event_viewer_data->hbox_v; else return NULL; @@ -293,10 +291,6 @@ gui_events(Tab *tab, LttvTracesetSelector * s,char* key ) G_CALLBACK (tree_v_move_cursor_cb), event_viewer_data); - g_signal_connect (G_OBJECT (event_viewer_data->tree_v), "grab-focus", - G_CALLBACK (tree_v_grab_focus), - event_viewer_data); - // Use on each column! //gtk_tree_view_column_set_sizing(event_viewer_data->tree_v, GTK_TREE_VIEW_COLUMN_FIXED); @@ -1546,12 +1540,6 @@ gboolean traceset_changed(void * hook_data, void * call_data) } -void tree_v_grab_focus(GtkWidget *widget, gpointer data){ - EventViewerData *event_viewer_data = (EventViewerData *)data; - Tab * tab = event_viewer_data->tab; - lttvwindow_report_focus(tab, event_viewer_data->hbox_v); -} - void update_raw_data_array(EventViewerData* event_viewer_data, unsigned size) { EventFields * data; diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index 7a7d19c9..455113bc 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -149,16 +149,31 @@ LttvTracesetSelector * construct_traceset_selector(LttvTraceset * traceset) return s; } - static gboolean viewer_grab_focus(GtkWidget *widget, GdkEventButton *event, gpointer data) { - GtkWidget *viewer_container = GTK_WIDGET(data); + GtkWidget *viewer = GTK_WIDGET(data); + GtkWidget *viewer_container = gtk_widget_get_parent(viewer); g_debug("FOCUS GRABBED"); - g_object_set_data(G_OBJECT(viewer_container), "focused_viewer", widget); + g_object_set_data(G_OBJECT(viewer_container), "focused_viewer", viewer); + return 0; } +static void connect_focus_recursive(GtkWidget *widget, + GtkWidget *viewer) +{ + if(GTK_IS_CONTAINER(widget)) { + gtk_container_forall(GTK_CONTAINER(widget), + (GtkCallback)connect_focus_recursive, + viewer); + } + gtk_widget_add_events(widget, GDK_BUTTON_PRESS_MASK); + g_signal_connect (G_OBJECT(widget), + "button-press-event", + G_CALLBACK (viewer_grab_focus), + (gpointer)viewer); +} /* insert_viewer function constructs an instance of a viewer first, * then inserts the widget of the instance into the container of the @@ -208,22 +223,13 @@ void insert_viewer(GtkWidget* widget, lttvwindow_viewer_constructor constructor) TRUE, 0); - g_signal_connect (G_OBJECT(viewer), - "button-press-event", - G_CALLBACK (viewer_grab_focus), - (gpointer)viewer_container); - - // We unref here, because it is now referenced by the viewer_container! - // not for a box ... g_object_unref(G_OBJECT(viewer)); - - // The viewer will show itself when it receives a show notify - // So we call the show notify hooks here. It will - // typically add hooks for reading, we call process trace, and the - // end of reading hook will call gtk_widget_show and unregister the - // hooks. - // Note that show notify gets the time_requested through the call_data. - //show_viewer(mw_data); - // in expose now call_pending_read_hooks(mw_data); + /* We want to connect the viewer_grab_focus to EVERY + * child of this widget. The little trick is to get each child + * of each GTK_CONTAINER, even subchildren. + */ + { + connect_focus_recursive(viewer, viewer); + } } } diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c index a0971163..9f153a75 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c @@ -785,23 +785,6 @@ void lttvwindow_report_dividor(Tab *tab, gint position) lttv_hooks_call(tmp, &position); } -/** - * Function to set the focused pane (viewer). - * It will be called by a viewer's signal handle associated with - * the grab_focus signal - * @param tab viewer's tab - * @param top_widget the top widget containing all the other widgets of the - * viewer. - */ - -void lttvwindow_report_focus(Tab *tab, GtkWidget *top_widget) -{ - //FIXME - //gtk_multi_vpaned_set_focus(tab->multivpaned, - // GTK_PANED(gtk_widget_get_parent(top_widget))); -} - - /** * Function to request data in a specific time interval to the main window. The * event request servicing is differed until the glib idle functions are diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h index 9711f561..a555c75e 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h @@ -119,8 +119,6 @@ Available report methods are : lttvwindow_report_time_window : reports the new time window. lttvwindow_report_current_time : reports the new current time. lttvwindow_report_dividor : reports the new horizontal dividor's position. -lttvwindow_report_focus : One on the widgets in the viewer has the keyboard's - focus from GTK. @@ -588,18 +586,6 @@ void lttvwindow_report_current_time(Tab *tab, void lttvwindow_report_dividor(Tab *tab, gint position); -/** - * Function to set the focused viewer of the tab. - * It will be called by a viewer's signal handle associated with - * the grab_focus signal of all widgets in the viewer. - * - * @param tab the tab the viewer belongs to. - * @param top_widget the top widget containing all the other widgets of the - * viewer. - */ -void lttvwindow_report_focus(Tab *tab, - GtkWidget *top_widget); - /* Structure sent to the events request hook */ /* Value considered as empty*/ diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c index 63ae23cf..46e5cec9 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c +++ b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c @@ -58,7 +58,6 @@ StatisticViewerData *gui_statistic(Tab *tab); //! Statistic Viewer's destructor void gui_statistic_destructor(StatisticViewerData *statistic_viewer_data); -void grab_focus(GtkWidget *widget, gpointer data); static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data); void statistic_destroy_hash_key(gpointer key); @@ -291,10 +290,6 @@ gui_statistic(Tab *tab) GTK_TREE_MODEL (statistic_viewer_data->store_m)); g_object_unref (G_OBJECT (statistic_viewer_data->store_m)); - g_signal_connect (G_OBJECT (statistic_viewer_data->tree_v), "grab-focus", - G_CALLBACK (grab_focus), - statistic_viewer_data); - // Setup the selection handler statistic_viewer_data->select_c = gtk_tree_view_get_selection (GTK_TREE_VIEW (statistic_viewer_data->tree_v)); gtk_tree_selection_set_mode (statistic_viewer_data->select_c, GTK_SELECTION_SINGLE); @@ -327,9 +322,6 @@ gui_statistic(Tab *tab) GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); statistic_viewer_data->text_v = gtk_text_view_new (); - g_signal_connect (G_OBJECT (statistic_viewer_data->text_v), "grab-focus", - G_CALLBACK (grab_focus), - statistic_viewer_data); gtk_text_view_set_editable(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); @@ -356,13 +348,6 @@ gui_statistic(Tab *tab) return statistic_viewer_data; } -void grab_focus(GtkWidget *widget, gpointer data) -{ - StatisticViewerData *statistic_viewer_data = (StatisticViewerData *)data; - Tab * tab = statistic_viewer_data->tab; - lttvwindow_report_focus(tab, guistatistic_get_widget(statistic_viewer_data)); -} - static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) {