[geany/geany-plugins] d6328a: fixes a bug with calltips still being shown when a pointer leaves editor window

Alexander Petukhov git-noreply at xxxxx
Sat Apr 7 08:03:33 UTC 2012


Branch:      refs/heads/master
Author:      Alexander Petukhov <devel at apetukhov.ru>
Committer:   Alexander Petukhov <devel at apetukhov.ru>
Date:        Sat, 07 Apr 2012 08:03:33
Commit:      d6328a74d28f225caf9d6c205d4f4487b007c45e
             https://github.com/geany/geany-plugins/commit/d6328a74d28f225caf9d6c205d4f4487b007c45e

Log Message:
-----------
fixes a bug with calltips still being shown when a pointer leaves editor window


Modified Paths:
--------------
    debugger/TODO
    debugger/src/callbacks.c

Modified: debugger/TODO
2 files changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -1,5 +1,4 @@
 BUGS:
-- tooltip appears even if a pointer in no longer inside editor window
 
 FEATURES:
 - custom tooltip with sticking facilities
@@ -8,6 +7,7 @@ FEATURES:
 - geany menu integration
 - toolbar buttons
 - margin context menu
+- editor context menu (add watch, add/remove breakpoint)
 - step back
 - tree views column width/autowidth
 - attach functionality: dbm_ methods providing target lists, common dialog


Modified: debugger/src/callbacks.c
24 files changed, 22 insertions(+), 2 deletions(-)
===================================================================
@@ -155,6 +155,21 @@ void on_document_open(GObject *obj, GeanyDocument *doc, gpointer user_data)
 }
 
 /*
+ * 	Handles mouse leave event to check if a calltip is still present and hides it if yes 
+ */
+static gint leave_signal;
+static gboolean on_mouse_leave(GtkWidget *widget, GdkEvent *event, gpointer user_data)
+{
+	ScintillaObject *so = (ScintillaObject*)widget;
+	if (scintilla_send_message (so, SCI_CALLTIPACTIVE, 0, 0))
+	{
+		g_signal_handler_disconnect(G_OBJECT(widget), leave_signal);
+		scintilla_send_message (so, SCI_CALLTIPCANCEL, 0, 0);
+	}
+	return FALSE;
+}
+
+/*
  * 	Occures on notify from editor.
  * 	Handles margin click to set/remove breakpoint 
  */
@@ -194,7 +209,7 @@ gboolean on_editor_notify(
 		{
 			if (DBS_STOPPED != debug_get_state ())
 				break;
-			
+
 			/* get a word under the cursor */
 			GString *word = get_word_at_position(editor->sci, nt->position);
 
@@ -203,6 +218,7 @@ gboolean on_editor_notify(
 				gchar *calltip = debug_get_calltip_for_expression(word->str);
 				if (calltip)
 				{
+					leave_signal = g_signal_connect(G_OBJECT(editor->sci), "leave-notify-event", G_CALLBACK(on_mouse_leave), NULL);
 					scintilla_send_message (editor->sci, SCI_CALLTIPSHOW, nt->position, (long)calltip);
 				}
 			}
@@ -216,7 +232,11 @@ gboolean on_editor_notify(
 			if (DBS_STOPPED != debug_get_state ())
 				break;
 
-			scintilla_send_message (editor->sci, SCI_CALLTIPCANCEL, 0, 0);
+			if (scintilla_send_message (editor->sci, SCI_CALLTIPACTIVE, 0, 0))
+			{
+				g_signal_handler_disconnect(G_OBJECT(editor->sci), leave_signal);
+				scintilla_send_message (editor->sci, SCI_CALLTIPCANCEL, 0, 0);
+			}
 			break;
 		}
 		case SCN_MODIFYATTEMPTRO:


@@ Diff output truncated at 100000 characters. @@


--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).



More information about the Plugins-Commits mailing list