mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
apprt/gtk: cursor state should be on surface
This commit is contained in:
@ -45,9 +45,6 @@ pub const App = struct {
|
|||||||
app: *c.GtkApplication,
|
app: *c.GtkApplication,
|
||||||
ctx: *c.GMainContext,
|
ctx: *c.GMainContext,
|
||||||
|
|
||||||
/// Any active cursor we may have
|
|
||||||
cursor: ?*c.GdkCursor = null,
|
|
||||||
|
|
||||||
/// This is set to false when the main loop should exit.
|
/// This is set to false when the main loop should exit.
|
||||||
running: bool = true,
|
running: bool = true,
|
||||||
|
|
||||||
@ -147,8 +144,6 @@ pub const App = struct {
|
|||||||
c.g_main_context_release(self.ctx);
|
c.g_main_context_release(self.ctx);
|
||||||
c.g_object_unref(self.app);
|
c.g_object_unref(self.app);
|
||||||
|
|
||||||
if (self.cursor) |cursor| c.g_object_unref(cursor);
|
|
||||||
|
|
||||||
self.config.deinit();
|
self.config.deinit();
|
||||||
|
|
||||||
glfw.terminate();
|
glfw.terminate();
|
||||||
@ -714,6 +709,9 @@ pub const Surface = struct {
|
|||||||
/// Our GTK area
|
/// Our GTK area
|
||||||
gl_area: *c.GtkGLArea,
|
gl_area: *c.GtkGLArea,
|
||||||
|
|
||||||
|
/// Any active cursor we may have
|
||||||
|
cursor: ?*c.GdkCursor = null,
|
||||||
|
|
||||||
/// Our title label (if there is one).
|
/// Our title label (if there is one).
|
||||||
title: Title,
|
title: Title,
|
||||||
|
|
||||||
@ -790,9 +788,6 @@ pub const Surface = struct {
|
|||||||
c.gtk_widget_set_focusable(widget, 1);
|
c.gtk_widget_set_focusable(widget, 1);
|
||||||
c.gtk_widget_set_focus_on_click(widget, 1);
|
c.gtk_widget_set_focus_on_click(widget, 1);
|
||||||
|
|
||||||
// When we're over the widget, set the cursor to the ibeam
|
|
||||||
c.gtk_widget_set_cursor(widget, app.cursor);
|
|
||||||
|
|
||||||
// Build our result
|
// Build our result
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.app = app,
|
.app = app,
|
||||||
@ -872,6 +867,8 @@ pub const Surface = struct {
|
|||||||
// Free all our GTK stuff
|
// Free all our GTK stuff
|
||||||
c.g_object_unref(self.im_context);
|
c.g_object_unref(self.im_context);
|
||||||
c.g_value_unset(&self.clipboard);
|
c.g_value_unset(&self.clipboard);
|
||||||
|
|
||||||
|
if (self.cursor) |cursor| c.g_object_unref(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn render(self: *Surface) !void {
|
fn render(self: *Surface) !void {
|
||||||
@ -1041,8 +1038,8 @@ pub const Surface = struct {
|
|||||||
c.gtk_widget_set_cursor(@ptrCast(self.gl_area), cursor);
|
c.gtk_widget_set_cursor(@ptrCast(self.gl_area), cursor);
|
||||||
|
|
||||||
// Free our existing cursor
|
// Free our existing cursor
|
||||||
if (self.app.cursor) |old| c.g_object_unref(old);
|
if (self.cursor) |old| c.g_object_unref(old);
|
||||||
self.app.cursor = cursor;
|
self.cursor = cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getClipboardString(
|
pub fn getClipboardString(
|
||||||
|
Reference in New Issue
Block a user