Skip to content

Commit

Permalink
hide cursor when idle
Browse files Browse the repository at this point in the history
  • Loading branch information
jovanlanik committed Apr 17, 2024
1 parent b4de93e commit f1e08f8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ void window_idle_hide(struct Window *ctx) {
GtkStyleContext *context = gtk_widget_get_style_context(ctx->window);
gtk_style_context_add_class(context, "hidden");
gtk_revealer_set_reveal_child(GTK_REVEALER(ctx->body_revealer), FALSE);
GdkCursor *cursor = gdk_cursor_new_for_display(gtk_widget_get_display(ctx->window), GDK_BLANK_CURSOR);
gdk_window_set_cursor(gtk_widget_get_window(ctx->window), cursor);
g_object_unref(cursor);
}

void window_idle_show(struct Window *ctx) {
Expand All @@ -235,6 +238,9 @@ void window_idle_show(struct Window *ctx) {
gtk_revealer_set_reveal_child(GTK_REVEALER(ctx->body_revealer), TRUE);
gtk_entry_grab_focus_without_selecting(GTK_ENTRY(ctx->input_field));
}
GdkCursor *cursor = gdk_cursor_new_from_name(gtk_widget_get_display(ctx->window), "default");
gdk_window_set_cursor(gtk_widget_get_window(ctx->window), cursor);
g_object_unref(cursor);
}

static gboolean window_idle_key(GtkWidget *self, GdkEventKey event, gpointer user_data) {
Expand Down

0 comments on commit f1e08f8

Please sign in to comment.