SF.net SVN: geany: [1609] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Mon Jun 11 08:58:37 UTC 2007


Revision: 1609
          http://svn.sourceforge.net/geany/?rev=1609&view=rev
Author:   eht16
Date:     2007-06-11 01:58:37 -0700 (Mon, 11 Jun 2007)

Log Message:
-----------
Add auto focus (to auto focus widgets below mouse cursor).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/geany.glade
    trunk/src/callbacks.c
    trunk/src/callbacks.h
    trunk/src/document.c
    trunk/src/geany.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/main.c
    trunk/src/prefs.c
    trunk/src/vte.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/ChangeLog	2007-06-11 08:58:37 UTC (rev 1609)
@@ -1,3 +1,10 @@
+2007-06-11  Enrico Tröger  <enrico.troeger at uvena.de>
+
+ * geany.glade, src/callbacks.c, src/callbacks.h, src/document.c,
+   src/geany.h, src/interface.c, src/keyfile.c, src/main.c, src/prefs.c,
+   src/vte.c: Add auto focus (to auto focus widgets below mouse cursor).
+
+
 2007-06-10  Enrico Tröger  <enrico.troeger at uvena.de>
 
  * src/treeviews.c: Prevent double jump to line when clicking on a

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/geany.glade	2007-06-11 08:58:37 UTC (rev 1609)
@@ -3248,6 +3248,26 @@
 			  </child>
 
 			  <child>
+			    <widget class="GtkCheckButton" id="check_auto_focus">
+			      <property name="visible">True</property>
+			      <property name="tooltip" translatable="yes">Gives the focus automatically to widgets below the mouse cursor. Works for the main editor widget, the scribble, the toolbar search and goto line fields and the VTE.</property>
+			      <property name="can_focus">True</property>
+			      <property name="label" translatable="yes">Auto focus widgets (focus follows mouse)</property>
+			      <property name="use_underline">True</property>
+			      <property name="relief">GTK_RELIEF_NORMAL</property>
+			      <property name="focus_on_click">False</property>
+			      <property name="active">False</property>
+			      <property name="inconsistent">False</property>
+			      <property name="draw_indicator">True</property>
+			    </widget>
+			    <packing>
+			      <property name="padding">0</property>
+			      <property name="expand">False</property>
+			      <property name="fill">False</property>
+			    </packing>
+			  </child>
+
+			  <child>
 			    <widget class="GtkCheckButton" id="check_ask_suppress_search_dialogs">
 			      <property name="visible">True</property>
 			      <property name="tooltip" translatable="yes">Always wrap search around the document and hide the Find dialog after clicking Find Next/Previous</property>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/callbacks.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -2235,3 +2235,12 @@
 	navqueue_go_back();
 }
 
+
+gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
+{
+	if (app->auto_focus && ! GTK_WIDGET_HAS_FOCUS(widget))
+		gtk_widget_grab_focus(widget);
+
+	return FALSE;
+}
+

Modified: trunk/src/callbacks.h
===================================================================
--- trunk/src/callbacks.h	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/callbacks.h	2007-06-11 08:58:37 UTC (rev 1609)
@@ -611,3 +611,8 @@
 void
 on_file1_activate                      (GtkMenuItem     *menuitem,
                                         gpointer         user_data);
+
+gboolean
+on_motion_event                        (GtkWidget       *widget,
+                                        GdkEventMotion  *event,
+                                        gpointer         user_data);

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/document.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -66,6 +66,7 @@
 #include "vte.h"
 #include "build.h"
 #include "symbols.h"
+#include "callbacks.h"
 
 
 /* dynamic array of document elements to hold all information of the notebook tabs */
@@ -315,8 +316,9 @@
 	//g_signal_connect((GtkWidget*) sci, "key-press-event",
 					//G_CALLBACK(keybindings_got_event), GINT_TO_POINTER(new_idx));
 	// signal for the popup menu
-	g_signal_connect((GtkWidget*) sci, "button-press-event",
+	g_signal_connect(G_OBJECT(sci), "button-press-event",
 					G_CALLBACK(on_editor_button_press_event), GINT_TO_POINTER(new_idx));
+	g_signal_connect(G_OBJECT(sci), "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
 
 	pfd = pango_font_description_from_string(app->editor_font);
 	fname = g_strdup_printf("!%s", pango_font_description_get_family(pfd));

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/geany.h	2007-06-11 08:58:37 UTC (rev 1609)
@@ -96,6 +96,7 @@
 	gboolean			 fullscreen;
 	gboolean			 beep_on_errors;
 	gboolean			 switch_msgwin_pages;
+	gboolean			 auto_focus;
 	gboolean			 show_notebook_tabs;
 	gboolean			 tab_order_ltr;
 	gboolean			 show_markers_margin;

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/interface.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -2407,6 +2407,7 @@
   GtkWidget *vbox21;
   GtkWidget *check_beep;
   GtkWidget *check_switch_pages;
+  GtkWidget *check_auto_focus;
   GtkWidget *check_ask_suppress_search_dialogs;
   GtkWidget *label178;
   GtkWidget *frame24;
@@ -2731,6 +2732,12 @@
   gtk_tooltips_set_tip (tooltips, check_switch_pages, _("Switch to the status message tab (in the notebook window at the bottom) if a new status message arrives."), NULL);
   gtk_button_set_focus_on_click (GTK_BUTTON (check_switch_pages), FALSE);
 
+  check_auto_focus = gtk_check_button_new_with_mnemonic (_("Auto focus widgets (focus follows mouse)"));
+  gtk_widget_show (check_auto_focus);
+  gtk_box_pack_start (GTK_BOX (vbox21), check_auto_focus, FALSE, FALSE, 0);
+  gtk_tooltips_set_tip (tooltips, check_auto_focus, _("Gives the focus automatically to widgets below the mouse cursor. Works for the main editor widget, the scribble, the toolbar search and goto line fields and the VTE."), NULL);
+  gtk_button_set_focus_on_click (GTK_BUTTON (check_auto_focus), FALSE);
+
   check_ask_suppress_search_dialogs = gtk_check_button_new_with_mnemonic (_("Always wrap search and hide the Find dialog"));
   gtk_widget_show (check_ask_suppress_search_dialogs);
   gtk_box_pack_start (GTK_BOX (vbox21), check_ask_suppress_search_dialogs, FALSE, FALSE, 0);
@@ -4036,6 +4043,7 @@
   GLADE_HOOKUP_OBJECT (prefs_dialog, vbox21, "vbox21");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_beep, "check_beep");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_switch_pages, "check_switch_pages");
+  GLADE_HOOKUP_OBJECT (prefs_dialog, check_auto_focus, "check_auto_focus");
   GLADE_HOOKUP_OBJECT (prefs_dialog, check_ask_suppress_search_dialogs, "check_ask_suppress_search_dialogs");
   GLADE_HOOKUP_OBJECT (prefs_dialog, label178, "label178");
   GLADE_HOOKUP_OBJECT (prefs_dialog, frame24, "frame24");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/keyfile.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -192,6 +192,7 @@
 	g_key_file_set_boolean(config, PACKAGE, "show_notebook_tabs", app->show_notebook_tabs);
 	g_key_file_set_boolean(config, PACKAGE, "brace_match_ltgt", app->brace_match_ltgt);
 	g_key_file_set_boolean(config, PACKAGE, "switch_msgwin_pages", app->switch_msgwin_pages);
+	g_key_file_set_boolean(config, PACKAGE, "auto_focus", app->auto_focus);
 	g_key_file_set_boolean(config, PACKAGE, "auto_close_xml_tags", editor_prefs.auto_close_xml_tags);
 	g_key_file_set_boolean(config, PACKAGE, "auto_complete_constructs", editor_prefs.auto_complete_constructs);
 	g_key_file_set_boolean(config, PACKAGE, "auto_complete_symbols", editor_prefs.auto_complete_symbols);
@@ -408,6 +409,7 @@
 	app->show_notebook_tabs = utils_get_setting_boolean(config, PACKAGE, "show_notebook_tabs", TRUE);
 	app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE);
 	app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE);
+	app->auto_focus = utils_get_setting_boolean(config, PACKAGE, "auto_focus", FALSE);
 	app->custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", "");
 	app->context_action_cmd = utils_get_setting_string(config, PACKAGE, "context_action_cmd", "");
 	app->default_open_path = utils_get_setting_string(config, PACKAGE, "default_open_path", "");

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/main.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -679,6 +679,12 @@
 	g_signal_connect(G_OBJECT(app->window), "delete_event", G_CALLBACK(on_exit_clicked), NULL);
 	g_signal_connect(G_OBJECT(app->window), "key-press-event", G_CALLBACK(on_window_key_press_event), NULL);
 	g_signal_connect(G_OBJECT(app->toolbar), "button-press-event", G_CALLBACK(toolbar_popup_menu), NULL);
+	g_signal_connect(G_OBJECT(lookup_widget(app->window, "textview_scribble")),
+							"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
+	g_signal_connect(G_OBJECT(lookup_widget(app->window, "entry1")),
+							"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
+	g_signal_connect(G_OBJECT(lookup_widget(app->window, "entry_goto_line")),
+							"motion-notify-event", G_CALLBACK(on_motion_event), NULL);
 
 	treeviews_prepare_openfiles();
 	treeviews_create_taglist_popup_menu();

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/prefs.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -96,6 +96,9 @@
 	widget = lookup_widget(app->prefs_dialog, "check_switch_pages");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->switch_msgwin_pages);
 
+	widget = lookup_widget(app->prefs_dialog, "check_auto_focus");
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->auto_focus);
+
 	widget = lookup_widget(app->prefs_dialog, "check_ask_for_quit");
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), app->pref_main_confirm_exit);
 
@@ -448,6 +451,9 @@
 		widget = lookup_widget(app->prefs_dialog, "check_switch_pages");
 		app->switch_msgwin_pages = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
 
+		widget = lookup_widget(app->prefs_dialog, "check_auto_focus");
+		app->auto_focus = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+
 		widget = lookup_widget(app->prefs_dialog, "entry_contextaction");
 		g_free(app->context_action_cmd);
 		app->context_action_cmd = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));

Modified: trunk/src/vte.c
===================================================================
--- trunk/src/vte.c	2007-06-10 20:09:22 UTC (rev 1608)
+++ trunk/src/vte.c	2007-06-11 08:58:37 UTC (rev 1609)
@@ -40,6 +40,7 @@
 #include "ui_utils.h"
 #include "utils.h"
 #include "document.h"
+#include "callbacks.h"
 
 
 VteInfo vte_info;
@@ -194,6 +195,7 @@
 	g_signal_connect(G_OBJECT(vte), "child-exited", G_CALLBACK(vte_start), NULL);
 	g_signal_connect(G_OBJECT(vte), "button-press-event", G_CALLBACK(vte_button_pressed), NULL);
 	g_signal_connect(G_OBJECT(vte), "event", G_CALLBACK(vte_keypress), NULL);
+	g_signal_connect(G_OBJECT(vte), "motion-notify-event", G_CALLBACK(on_motion_event), NULL);
 	//g_signal_connect(G_OBJECT(vte), "drag-data-received", G_CALLBACK(vte_drag_data_received), NULL);
 	//g_signal_connect(G_OBJECT(vte), "drag-drop", G_CALLBACK(vte_drag_drop), NULL);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list