cocoawebview 0.3.13 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b99958f5f5331f8902bf5b2e36829992c752d1d1137c79c8a40dac5b532abee
4
- data.tar.gz: 0a4efac1c163db618cb3de595b19df6103865600ad713b1e1234b6267d668819
3
+ metadata.gz: a1ec109cf8255bd277ee378cfc3785086c5fb0706cfacb296dda79105e366731
4
+ data.tar.gz: 2f8e836e3658226d6368b897f13c6f7b875ea5151c3a754b48f1b1bd80690e50
5
5
  SHA512:
6
- metadata.gz: 9fdaa37347f271bc56bfe6c910b60092a8931ffbd3fb256cb192d591d01f29604b73ab1f9afc01ae0bb8a6fcbb8320a5080b9d090d70dd66d46969e5ccc779f8
7
- data.tar.gz: 83aa2369a6615c8295ea31759988f6a5ddfa66420c42ca4ae229425aad882d6d785f8b429c19cfc4ff4fa5d1513e18f55b080a5d2f6cffeb8fa2edbe1f84580f
6
+ metadata.gz: 19b3abe6843ac1ec662d6390ad8efb261fbf73f809a3505646bdd3d2321e57ce0546a7a5c4275a65fcfcb0b9ca11a568e03a774815398e4bd5311b156a90ef7a
7
+ data.tar.gz: f10d376ef47bb04c5a1b7a8b6c4247d9d9a787ab7166da7c9da080e3f9ba2bb1e1c2aa51918b822a5e6e014abffb56894cdd136998e8e13a6a505c55c00c12e3
@@ -11,7 +11,7 @@ VALUE nsapp_initialize(VALUE self);
11
11
  VALUE nsapp_run(VALUE self);
12
12
  VALUE nsapp_exit(VALUE self);
13
13
 
14
- VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons);
14
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y);
15
15
  VALUE webview_show(VALUE self);
16
16
  VALUE webview_hide(VALUE self);
17
17
  VALUE webview_eval(VALUE self, VALUE code);
@@ -104,15 +104,12 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
104
104
  app = a;
105
105
  }
106
106
 
107
- - (void)appBecameActive:(NSNotification *)notification {
107
+ - (BOOL)applicationShouldHandleReopen:(NSApplication *)sender hasVisibleWindows:(BOOL)flag {
108
108
  rb_funcall(app, rb_intern("dock_did_click"), 0);
109
+ return YES;
109
110
  }
110
111
 
111
112
  - (void)applicationDidFinishLaunching:(NSNotification *)notification {
112
- [[NSNotificationCenter defaultCenter] addObserver:self
113
- selector:@selector(appBecameActive:)
114
- name:NSApplicationDidBecomeActiveNotification
115
- object:nil];
116
113
  rb_funcall(app, rb_intern("app_did_launch"), 0);
117
114
  }
118
115
  @end
@@ -123,17 +120,19 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
123
120
  BOOL showDevTool;
124
121
  BOOL shouldMoveTitleButtons;
125
122
  FileDropContainerView *fileDropView;
123
+ int deltaY;
126
124
  }
127
125
  - (void)setShouldMoveTitleButtons:(BOOL)flag;
128
126
  - (void)setDevTool:(BOOL)flag;
129
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons;
127
+ - (void)setDeltaY:(int)dy;
128
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy;
130
129
  - (void)eval:(NSString*)code;
131
130
  - (void)setCocoaWebview:(VALUE)view;
132
131
  - (void)dragging;
133
132
  @end
134
133
 
135
134
  @implementation CocoaWebview
136
- - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons{
135
+ - (id)initWithFrame:(NSRect)frame debug:(BOOL)flag style:(int)style moveTitleButtons:(BOOL)moveTitleButtons deltaY:(int)dy {
137
136
  self = [super initWithContentRect:frame
138
137
  styleMask:style
139
138
  backing:NSBackingStoreBuffered
@@ -142,6 +141,7 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
142
141
  [self center];
143
142
  [self setTitle:@"My Custom Window"];
144
143
  [self setDevTool:flag];
144
+ [self setDeltaY:dy];
145
145
  [self setTitlebarAppearsTransparent: YES];
146
146
  [self setTitleVisibility:NSWindowTitleHidden];
147
147
  [self addWebViewToWindow:self];
@@ -157,6 +157,10 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
157
157
  return self;
158
158
  }
159
159
 
160
+ - (void)setDeltaY:(int)dy {
161
+ deltaY = dy;
162
+ }
163
+
160
164
  - (void)setShouldMoveTitleButtons:(BOOL)flag {
161
165
  shouldMoveTitleButtons = flag;
162
166
  }
@@ -170,15 +174,15 @@ VALUE webview_set_bg(VALUE self, VALUE r, VALUE g, VALUE b, VALUE a);
170
174
  - (void)moveWindowButtonsForWindow:(NSWindow *)window {
171
175
  //Close Button
172
176
  NSButton *closeButton = [window standardWindowButton:NSWindowCloseButton];
173
- [closeButton setFrameOrigin:NSMakePoint(closeButton.frame.origin.x + 10, closeButton.frame.origin.y - 10)];
177
+ [closeButton setFrameOrigin:NSMakePoint(closeButton.frame.origin.x + 10, closeButton.frame.origin.y - deltaY)];
174
178
 
175
179
  //Minimize Button
176
180
  NSButton *minimizeButton = [window standardWindowButton:NSWindowMiniaturizeButton];
177
- [minimizeButton setFrameOrigin:NSMakePoint(minimizeButton.frame.origin.x + 10, minimizeButton.frame.origin.y - 10)];
181
+ [minimizeButton setFrameOrigin:NSMakePoint(minimizeButton.frame.origin.x + 10, minimizeButton.frame.origin.y - deltaY)];
178
182
 
179
183
  //Zoom Button
180
184
  NSButton *zoomButton = [window standardWindowButton:NSWindowZoomButton];
181
- [zoomButton setFrameOrigin:NSMakePoint(zoomButton.frame.origin.x + 10, zoomButton.frame.origin.y - 10)];
185
+ [zoomButton setFrameOrigin:NSMakePoint(zoomButton.frame.origin.x + 10, zoomButton.frame.origin.y - deltaY)];
182
186
  }
183
187
 
184
188
  - (void)close {
@@ -294,7 +298,7 @@ Init_cocoawebview(void)
294
298
 
295
299
  /* CocoaWebview */
296
300
  rb_mCocoaWebviewClass = rb_define_class_under(rb_mCocoawebview, "CocoaWebview", rb_cObject);
297
- rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 3);
301
+ rb_define_method(rb_mCocoaWebviewClass, "initialize", webview_initialize, 4);
298
302
  rb_define_method(rb_mCocoaWebviewClass, "show", webview_show, 0);
299
303
  rb_define_method(rb_mCocoaWebviewClass, "hide", webview_hide, 0);
300
304
  rb_define_method(rb_mCocoaWebviewClass, "eval", webview_eval, 1);
@@ -328,7 +332,7 @@ VALUE nsapp_exit(VALUE self) {
328
332
  [[NSApplication sharedApplication] terminate:nil];
329
333
  }
330
334
 
331
- VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons) {
335
+ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_buttons, VALUE delta_y) {
332
336
  rb_iv_set(self, "@var", rb_hash_new());
333
337
  rb_iv_set(self, "@bindings", rb_hash_new());
334
338
  BOOL flag = NO;
@@ -345,7 +349,8 @@ VALUE webview_initialize(VALUE self, VALUE debug, VALUE style, VALUE move_title_
345
349
  c_move_title_buttons = NO;
346
350
  }
347
351
  int c_style = NUM2INT(style);
348
- CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons];
352
+ int c_delta_y = NUM2INT(delta_y);
353
+ CocoaWebview *webview = [[CocoaWebview alloc] initWithFrame:NSMakeRect(100, 100, 400, 500) debug:flag style:c_style moveTitleButtons:c_move_title_buttons deltaY:c_delta_y];
349
354
 
350
355
  [webview setReleasedWhenClosed:NO];
351
356
  [webview setCocoaWebview:self];
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Cocoawebview
4
- VERSION = "0.3.13"
4
+ VERSION = "0.3.15"
5
5
  end
data/lib/cocoawebview.rb CHANGED
@@ -28,7 +28,7 @@ module CocoaWebview
28
28
  class CocoaWebview
29
29
  attr_accessor :callback
30
30
 
31
- def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, &block)
31
+ def self.create(debug: false, min: true, resize: true, close: true, move_title_buttons: false, delta_y: 10, &block)
32
32
  style = NSWindowStyleMaskTitled | NSWindowStyleMaskFullSizeContentView
33
33
 
34
34
  style = style | NSWindowStyleMaskMiniaturizable if min
@@ -37,7 +37,7 @@ module CocoaWebview
37
37
 
38
38
  style &= ~NSWindowStyleMaskFullScreen
39
39
 
40
- webview = new(debug, style, move_title_buttons)
40
+ webview = new(debug, style, move_title_buttons, delta_y)
41
41
  webview.callback = block
42
42
  webview
43
43
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoawebview
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.13
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Jeff
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-07-07 00:00:00.000000000 Z
10
+ date: 2025-07-09 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: Webview ruby binding for macOS
13
13
  email: