Focus works
authorcompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 8 Aug 2004 06:52:52 +0000 (06:52 +0000)
committercompudj <compudj@04897980-b3bd-0310-b5e0-8ef037075253>
Sun, 8 Aug 2004 06:52:52 +0000 (06:52 +0000)
git-svn-id: http://ltt.polymtl.ca/svn@674 04897980-b3bd-0310-b5e0-8ef037075253

ltt/branches/poly/lttv/modules/gui/controlflow/cfv.c
ltt/branches/poly/lttv/modules/gui/controlflow/drawing.c
ltt/branches/poly/lttv/modules/gui/controlflow/eventhooks.c
ltt/branches/poly/lttv/modules/gui/detailedevents/events.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.c
ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/lttvwindow.h
ltt/branches/poly/lttv/modules/gui/statistics/statistics.c

index ba53e288b56980815d63834fae7b7613581c175d..ba15e15cecf863366164d303d85c5c4bdf41dcf0 100644 (file)
 
 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;
 
index 8ef1b4300bd9e346446be55c211dfeede78da761..38578cfcf40da29bdd7ca2226db252ff3c2167b6 100644 (file)
@@ -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),
index 5b7d22b31a0df4fa465e6b559c1d561f373fdb06..13c1e296280ffc50a95a99858f2a932376d5dafb 100644 (file)
@@ -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;
 
 
index f18727ab70788b9c31afcbd6d0fef0cdac27da64..38030ba879e5ead8c042f8ab2c32f650ee58ba13 100644 (file)
@@ -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;
index 7a7d19c96484766437ad90ff4675c91340284ed9..455113bc9ee0609bb74eaf32302dc01e33ea4373 100644 (file)
@@ -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);
+    }
   }
 }
 
index a0971163bcaa0c772e322b30226ca8e505643c83..9f153a75ed54169a1b92dc388a383c1ec113e98d 100644 (file)
@@ -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
index 9711f561b68805d81c1658119a959daa8d4ddb97..a555c75e459bd709a0efd358a1bb5e262763a04d 100644 (file)
@@ -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*/
index 63ae23cf06256c27909d0966f4af58929336d408..46e5cec92fd5587087c191a358f81b6bab8f9c55 100644 (file)
@@ -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)
 {
This page took 0.02891 seconds and 4 git commands to generate.