lib/glimmer/swt/shell_proxy.rb in glimmer-dsl-swt-4.18.3.0 vs lib/glimmer/swt/shell_proxy.rb in glimmer-dsl-swt-4.18.3.1

- old
+ new

@@ -43,15 +43,21 @@ # and the proxy wraps it instead of creating a new one. def initialize(*args, swt_widget: nil) if swt_widget @swt_widget = swt_widget else - if args.first.is_a?(ShellProxy) + if args.first.respond_to?(:swt_widget) && args.first.swt_widget.is_a?(Shell) @parent_proxy = args[0] args[0] = args[0].swt_widget end - style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)} + style_args = args.select {|arg| arg.is_a?(Symbol) || arg.is_a?(String)}.map(&:to_sym) + fill_screen = nil + if style_args.include?(:fill_screen) + args.delete(:fill_screen) + style_args.delete(:fill_screen) + fill_screen = true + end if style_args.any? style_arg_start_index = args.index(style_args.first) style_arg_last_index = args.index(style_args.last) args[style_arg_start_index..style_arg_last_index] = SWTProxy[style_args] end @@ -65,10 +71,11 @@ @swt_widget.setLayout(FillLayout.new) @swt_widget.setMinimumSize(WIDTH_MIN, HEIGHT_MIN) # TODO make this an option not the default shell_swt_display = Glimmer::SWT::DisplayProxy.instance.swt_display on_swt_show do + @swt_widget.set_size(@display.bounds.width, @display.bounds.height) if fill_screen Thread.new do sleep(0.25) shell_swt_display.async_exec do @swt_widget.setActive unless @swt_widget.isDisposed end @@ -107,9 +114,13 @@ end end def nested? !swt_widget&.parent.nil? + end + + def disposed? + swt_widget.isDisposed end def hide @swt_widget.setVisible(false) end