lib/glimmer/swt/shell_proxy.rb in glimmer-dsl-swt-4.18.2.3 vs lib/glimmer/swt/shell_proxy.rb in glimmer-dsl-swt-4.18.2.4
- old
+ new
@@ -44,10 +44,11 @@
def initialize(*args, swt_widget: nil)
if swt_widget
@swt_widget = swt_widget
else
if args.first.is_a?(ShellProxy)
+ @parent_proxy = args[0]
args[0] = args[0].swt_widget
end
style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}
if style_args.any?
style_arg_start_index = args.index(style_args.first)
@@ -76,11 +77,11 @@
end
@display ||= @swt_widget.getDisplay
end
# Centers shell within monitor it is in
- def center
+ def center_within_display
primary_monitor = @display.getPrimaryMonitor()
monitor_bounds = primary_monitor.getBounds()
shell_bounds = @swt_widget.getBounds()
location_x = monitor_bounds.x + (monitor_bounds.width - shell_bounds.width) / 2
location_y = monitor_bounds.y + (monitor_bounds.height - shell_bounds.height) / 2
@@ -99,10 +100,10 @@
if @opened_before
@swt_widget.setVisible(true)
else
@opened_before = true
@swt_widget.pack
- center
+ center_within_display
@swt_widget.open
end
end
def nested?