[gnome-builder] sourceview: do completion opacity on key-release
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] sourceview: do completion opacity on key-release
- Date: Thu, 25 Apr 2019 02:38:27 +0000 (UTC)
commit f9d13793b34ab44973285652b8617130f55e80e5
Author: Christian Hergert <chergert redhat com>
Date: Wed Apr 24 19:38:06 2019 -0700
sourceview: do completion opacity on key-release
src/libide/sourceview/ide-source-view.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/libide/sourceview/ide-source-view.c b/src/libide/sourceview/ide-source-view.c
index 4b0c467cf..9eecbbada 100644
--- a/src/libide/sourceview/ide-source-view.c
+++ b/src/libide/sourceview/ide-source-view.c
@@ -142,6 +142,7 @@ typedef struct
guint auto_indent : 1;
guint completion_blocked : 1;
+ guint did_ctrl_opacity : 1;
guint highlight_current_line : 1;
guint in_replay_macro : 1;
guint insert_mark_cleared : 1;
@@ -2036,16 +2037,12 @@ ide_source_view_key_press_event (GtkWidget *widget,
event->state == 0 &&
ide_completion_is_visible (priv->completion))
{
- IdeCompletionDisplay *display = ide_completion_get_display (priv->completion);
-
- if (gtk_widget_get_opacity (GTK_WIDGET (display)) == 1.0)
- gtk_widget_set_opacity (GTK_WIDGET (display), 0.1);
- else
- gtk_widget_set_opacity (GTK_WIDGET (display), 1.0);
-
- return TRUE;
+ priv->did_ctrl_opacity = TRUE;
+ return GDK_EVENT_STOP;
}
+ priv->did_ctrl_opacity = FALSE;
+
/*
* Are we currently recording a macro? If so lets stash the event for later.
*/
@@ -2196,6 +2193,23 @@ ide_source_view_key_release_event (GtkWidget *widget,
ret = GTK_WIDGET_CLASS (ide_source_view_parent_class)->key_release_event (widget, event);
+ if (priv->did_ctrl_opacity)
+ {
+ IdeCompletionDisplay *display = ide_completion_get_display (priv->completion);
+
+ if (event->keyval == GDK_KEY_Control_L &&
+ event->state == GDK_CONTROL_MASK &&
+ ide_completion_is_visible (priv->completion))
+ {
+ if (gtk_widget_get_opacity (GTK_WIDGET (display)) == 1.0)
+ gtk_widget_set_opacity (GTK_WIDGET (display), 0.1);
+ else
+ gtk_widget_set_opacity (GTK_WIDGET (display), 1.0);
+ }
+
+ priv->did_ctrl_opacity = FALSE;
+ }
+
if (priv->definition_src_location)
ide_source_view_reset_definition_highlight (self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]