autogui 1.0.0 → 1.0.1

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: d3511abdbcca45728263b40b8e8a42fe1ab6918e6f06c954b6a34556451d3732
4
- data.tar.gz: a2342704323c625b631235faaf9125ffd408bbb343c71b278374c960574ced32
3
+ metadata.gz: a127667e017faf9fbe1e753ed2e7f3f798d962c956d8cfedc9608ca87eac67e6
4
+ data.tar.gz: 0a1d1c83c364c68145bb792b7c36f5dc2a5d57378f23bf5c56314fa5b170be75
5
5
  SHA512:
6
- metadata.gz: 0fce037dcb816025469d84cd34602d2c8d7d03d61bb2b8211583e6204844c5043427fe91b6368fb7b8e7ba3a17a3bd8cf0d7ccaf600139a51fef0c21f3778671
7
- data.tar.gz: 153b87b1e059f94f4a2309acad12becef177f4e1ac8c5458d60325bfc75d6736301a112aa54f64c268be65b03961157033679b3dfd896072203e93dcca208145
6
+ metadata.gz: 86b02a48de330d63b52eda854a792344631d2387be99faa5d2b26e4945b2acb8eb2c1bdce9ff803cb8e5ef1ddb0209af4c822369fb22de3516ee3e9c2e787b33
7
+ data.tar.gz: 343aa3597a505ed1a498b68cbbc3f12ce6f95a253da50be820329aeb524575f0b2bc80ffd0ca1199d7e07ed703a2452fe8df9f927f730f2204fd274207115fbb
data/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@ All notable changes to this project are documented in this file.
5
5
  The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.1] — 2026-09-04
9
+
10
+ ### Fixed
11
+
12
+ - Windows `AutoGUI.alert` / `confirm` no longer raise `Encoding::CompatibilityError` when concatenating a UTF-16LE string with a binary null terminator.
13
+ - `module_function` aliases are promoted on `AutoGUI`, window helpers, and platform modules. This restores `resolution`, snake_case window APIs, and `vscroll`.
14
+ - Windows window titles decode from the returned UTF-16 length instead of stripping NUL bytes from a padded buffer.
15
+
8
16
  ## [1.0.0] — 2026-09-03
9
17
 
10
18
  ### Added
data/README.md CHANGED
@@ -74,7 +74,7 @@ Or build a `.gem` from the repo:
74
74
  git clone https://github.com/pardeep2690/autogui.git
75
75
  cd autogui
76
76
  gem build autogui.gemspec
77
- gem install autogui-1.0.0.gem
77
+ gem install autogui-1.0.1.gem
78
78
  ```
79
79
 
80
80
  ### Platform extras
@@ -180,6 +180,8 @@ module AutoGUI
180
180
  end
181
181
  sleep(AutoGUI.darwin_catch_up_time)
182
182
  end
183
+
184
+ Platform.copy_aliases!(self)
183
185
  end
184
186
  end
185
187
  end
@@ -167,6 +167,8 @@ module AutoGUI
167
167
  def command?(name)
168
168
  system("which", name, out: File::NULL, err: File::NULL)
169
169
  end
170
+
171
+ Platform.copy_aliases!(self)
170
172
  end
171
173
  end
172
174
  end
@@ -279,8 +279,12 @@ module AutoGUI
279
279
  return "" if len <= 0
280
280
 
281
281
  buf = "\x00".b * ((len + 1) * 2)
282
- GetWindowTextW(hwnd, buf, len + 1)
283
- buf.force_encoding("UTF-16LE").encode("UTF-8").delete("\x00")
282
+ copied = GetWindowTextW(hwnd, buf, len + 1)
283
+ return "" if copied <= 0
284
+
285
+ buf.byteslice(0, copied * 2)
286
+ .force_encoding("UTF-16LE")
287
+ .encode("UTF-8", invalid: :replace, undef: :replace)
284
288
  end
285
289
 
286
290
  def window_rect(hwnd)
@@ -393,8 +397,10 @@ module AutoGUI
393
397
  end
394
398
 
395
399
  def wide(str)
396
- (str.to_s.encode("UTF-16LE") + "\x00\x00".b).b
400
+ str.to_s.encode("UTF-16LE").b + "\x00\x00".b
397
401
  end
402
+
403
+ Platform.copy_aliases!(self)
398
404
  end
399
405
  end
400
406
  end
@@ -4,6 +4,18 @@ require "rbconfig"
4
4
 
5
5
  module AutoGUI
6
6
  module Platform
7
+ # `module_function` copies each `def` to the singleton class, but not later
8
+ # `alias` names. Promote any instance method that is still missing there.
9
+ def self.copy_aliases!(mod)
10
+ names = (mod.private_instance_methods(false) + mod.instance_methods(false)).uniq
11
+ names.each do |name|
12
+ sc = mod.singleton_class
13
+ next if sc.method_defined?(name) || sc.private_method_defined?(name)
14
+
15
+ mod.send(:module_function, name)
16
+ end
17
+ end
18
+
7
19
  module_function
8
20
 
9
21
  def current
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AutoGUI
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
@@ -166,5 +166,7 @@ module AutoGUI
166
166
  w&.title
167
167
  end
168
168
  alias get_active_window_title getActiveWindowTitle
169
+
170
+ Platform.copy_aliases!(self)
169
171
  end
170
172
  end
data/lib/autogui.rb CHANGED
@@ -684,48 +684,7 @@ module AutoGUI
684
684
  @log_screenshot_filenames << filename
685
685
  end
686
686
 
687
- # module_function copies methods to the singleton class but does not copy
688
- # subsequent `alias` names. Re-alias them on the singleton class.
689
- class << self
690
- {
691
- get_point_on_line: :getPointOnLine,
692
- fail_safe_check: :failSafeCheck,
693
- use_image_not_found_exception!: :useImageNotFoundException,
694
- on_screen: :onScreen,
695
- valid_key?: :isValidKey,
696
- is_valid_key: :isValidKey,
697
- mouse_down: :mouseDown,
698
- mouse_up: :mouseUp,
699
- left_click: :leftClick,
700
- right_click: :rightClick,
701
- middle_click: :middleClick,
702
- double_click: :doubleClick,
703
- triple_click: :tripleClick,
704
- move_to: :moveTo,
705
- move_rel: :moveRel,
706
- move: :moveRel,
707
- drag_to: :dragTo,
708
- drag_rel: :dragRel,
709
- drag: :dragRel,
710
- key_down: :keyDown,
711
- key_up: :keyUp,
712
- write: :typewrite,
713
- shortcut: :hotkey,
714
- grab: :screenshot,
715
- locate_on_screen: :locateOnScreen,
716
- locate_all_on_screen: :locateAllOnScreen,
717
- locate_center_on_screen: :locateCenterOnScreen,
718
- locate_all: :locateAll,
719
- locate_on_window: :locateOnWindow,
720
- pixel_matches_color: :pixelMatchesColor,
721
- mouse_info: :mouseInfo,
722
- display_mouse_position: :displayMousePosition,
723
- print_info: :printInfo,
724
- get_info: :getInfo
725
- }.each do |snake, camel|
726
- alias_method snake, camel if method_defined?(camel) || private_method_defined?(camel)
727
- end
728
- end
687
+ Platform.copy_aliases!(self)
729
688
  end
730
689
 
731
690
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autogui
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pardeep2690