Skip to content

Commit

Permalink
gtk4: define Gtk::ApplicationWindow#surface instead
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 14, 2024
1 parent c24b8fc commit f95f38b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 1 addition & 6 deletions lib/rabbit/command/rabbit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -854,12 +854,7 @@ def do_display
frame.init_gui(@options.width, @options.height, true)
frame.fullscreen if @options.full_screen
if @options.show_native_window_id
window = frame.window
if window.respond_to?(:surface)
native_surface = window.surface
else
native_surface = window.window
end
native_surface = frame.window.surface
if native_surface.respond_to?(:xid)
@logger.info(_("Window ID: %d") % native_surface.xid)
end
Expand Down
7 changes: 7 additions & 0 deletions lib/rabbit/gtk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,11 @@ def call(*args, &block)
end
end
end

class ApplicationWindow
# GTK 4 renames Gdk::Window to Gdk::Surface
unless method_defined?(:surface)
alias_method :surface, :window
end
end
end

0 comments on commit f95f38b

Please sign in to comment.