pure-x11 0.0.9 → 0.0.11
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 +4 -4
 - data/CLAUDE.md +47 -0
 - data/README.md +10 -0
 - data/lib/X11/display.rb +8 -0
 - data/lib/X11/form.rb +26 -12
 - data/lib/X11/version.rb +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b0aef4dac032e7cc033a474d8b3f19920c2dd18e55a98cdf08329c0dcb9f360e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 346955046f31e2e53a61183ddcd9d19db11dab82c9de8b9ea04c92b9f4900e93
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 417b477de5a70c6e0e568e218f007544823e1986c7969bd666bf4a8c9382c2af349ac745c693f3b9fe07aeccc9119fadda5daa6b0dfad6bb388218dc6af2ba03
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 153aacfb1fa54955eb14d6b186a65868a803f486c88d55b483a55097b81d545fab3888ebaff3332c1fa0d964d71293a49a08654d6fef71ed7501ab6926028185
         
     | 
    
        data/CLAUDE.md
    ADDED
    
    | 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Ruby X11 Development Guidelines
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            ## Build Commands
         
     | 
| 
      
 4 
     | 
    
         
            +
            - Install dependencies: `bundle install`
         
     | 
| 
      
 5 
     | 
    
         
            +
            - Run all tests: `rake test`
         
     | 
| 
      
 6 
     | 
    
         
            +
            - Run single test: `ruby test/specific_test.rb`
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            ## Code Style
         
     | 
| 
      
 9 
     | 
    
         
            +
            - Indentation: 2 spaces
         
     | 
| 
      
 10 
     | 
    
         
            +
            - Naming: snake_case for methods/variables, CamelCase for classes
         
     | 
| 
      
 11 
     | 
    
         
            +
            - Constants: ALL_CAPS or CamelCase (matching X11 protocol names)
         
     | 
| 
      
 12 
     | 
    
         
            +
            - Methods: One-line with `=` for simple methods (Ruby 3 syntax)
         
     | 
| 
      
 13 
     | 
    
         
            +
            - Error handling: Custom X11 error hierarchy (X11::BasicError, etc.)
         
     | 
| 
      
 14 
     | 
    
         
            +
            - Imports: require_relative for internal files, require for gems
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            ## Organization
         
     | 
| 
      
 17 
     | 
    
         
            +
            - Core functionality in lib/X11.rb
         
     | 
| 
      
 18 
     | 
    
         
            +
            - Components in lib/X11/ directory
         
     | 
| 
      
 19 
     | 
    
         
            +
            - Protocol definitions using DSL in form.rb
         
     | 
| 
      
 20 
     | 
    
         
            +
            - Test files in test/ directory with _test.rb suffix
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## Testing
         
     | 
| 
      
 23 
     | 
    
         
            +
            - Uses Minitest::Spec syntax: `_(object).must_equal expected`
         
     | 
| 
      
 24 
     | 
    
         
            +
            - Tests require helper.rb which sets up the environment
         
     | 
| 
      
 25 
     | 
    
         
            +
            - Mock objects for testing sockets/connections
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Documentation
         
     | 
| 
      
 28 
     | 
    
         
            +
            - Comments for complex logic
         
     | 
| 
      
 29 
     | 
    
         
            +
            - Reference X11 protocol documentation when implementing specs
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## Adding X11 Protocol Requests
         
     | 
| 
      
 32 
     | 
    
         
            +
            1. Define request form in lib/X11/form.rb:
         
     | 
| 
      
 33 
     | 
    
         
            +
               ```ruby
         
     | 
| 
      
 34 
     | 
    
         
            +
               class XRenderFreePicture < BaseForm
         
     | 
| 
      
 35 
     | 
    
         
            +
                 field :req_type, Uint8
         
     | 
| 
      
 36 
     | 
    
         
            +
                 field :render_req_type, Uint8, value: 7
         
     | 
| 
      
 37 
     | 
    
         
            +
                 field :request_length, Uint16, value: 2
         
     | 
| 
      
 38 
     | 
    
         
            +
                 field :picture, Uint32
         
     | 
| 
      
 39 
     | 
    
         
            +
               end
         
     | 
| 
      
 40 
     | 
    
         
            +
               ```
         
     | 
| 
      
 41 
     | 
    
         
            +
            2. Add helper method in lib/X11/display.rb:
         
     | 
| 
      
 42 
     | 
    
         
            +
               ```ruby
         
     | 
| 
      
 43 
     | 
    
         
            +
               def render_free_picture(picture)
         
     | 
| 
      
 44 
     | 
    
         
            +
                 write_request(Form::XRenderFreePicture.new(render_opcode, picture))
         
     | 
| 
      
 45 
     | 
    
         
            +
               end
         
     | 
| 
      
 46 
     | 
    
         
            +
               ```
         
     | 
| 
      
 47 
     | 
    
         
            +
            3. Update X11::VERSION in lib/X11/version.rb after adding new functionality
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -9,6 +9,16 @@ upstread everything. 
     | 
|
| 
       9 
9 
     | 
    
         
             
            This library is based off of Mathieu Bouchard's work on his RubyX11 project,
         
     | 
| 
       10 
10 
     | 
    
         
             
            and Richard Ramsdens excellent start on Ruby-X11.
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            Current known use (all mine...):
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
             * [RubyWM](https://github.com/vidarh/rubywm) - Pure Ruby window manager
         
     | 
| 
      
 15 
     | 
    
         
            +
             * [Skrift-X11](https://github.com/vidarh/skrift-x11) - X11 integration for pure Ruby Truetype font rendering
         
     | 
| 
      
 16 
     | 
    
         
            +
             * Rebar - not yet published wm toolbar
         
     | 
| 
      
 17 
     | 
    
         
            +
             * RubyTerm (name TBD) - not yet published version of Ruby terminal
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            If you're thinking of using pure-x11, drop me a note and I'll start being more
         
     | 
| 
      
 20 
     | 
    
         
            +
            cautious about breaking changes ;)
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       12 
22 
     | 
    
         
             
            Contributors
         
     | 
| 
       13 
23 
     | 
    
         
             
            ------------
         
     | 
| 
       14 
24 
     | 
    
         | 
    
        data/lib/X11/display.rb
    CHANGED
    
    | 
         @@ -541,6 +541,10 @@ module X11 
     | 
|
| 
       541 
541 
     | 
    
         
             
                def create_pixmap(depth, drawable, w,h)
         
     | 
| 
       542 
542 
     | 
    
         
             
                  new_id.tap{|pid| write_request(Form::CreatePixmap.new(depth, pid, drawable, w,h)) }
         
     | 
| 
       543 
543 
     | 
    
         
             
                end
         
     | 
| 
      
 544 
     | 
    
         
            +
                
         
     | 
| 
      
 545 
     | 
    
         
            +
                def free_pixmap(pixmap)
         
     | 
| 
      
 546 
     | 
    
         
            +
                  write_request(Form::FreePixmap.new(pixmap))
         
     | 
| 
      
 547 
     | 
    
         
            +
                end
         
     | 
| 
       544 
548 
     | 
    
         | 
| 
       545 
549 
     | 
    
         
             
                # XRender
         
     | 
| 
       546 
550 
     | 
    
         | 
| 
         @@ -651,6 +655,10 @@ module X11 
     | 
|
| 
       651 
655 
     | 
    
         
             
                  write_request(Form::XRenderCreateSolidFill.new(render_opcode,fill,color))
         
     | 
| 
       652 
656 
     | 
    
         
             
                  fill
         
     | 
| 
       653 
657 
     | 
    
         
             
                end
         
     | 
| 
      
 658 
     | 
    
         
            +
                
         
     | 
| 
      
 659 
     | 
    
         
            +
                def render_free_picture(picture)
         
     | 
| 
      
 660 
     | 
    
         
            +
                  write_request(Form::XRenderFreePicture.new(render_opcode, picture))
         
     | 
| 
      
 661 
     | 
    
         
            +
                end
         
     | 
| 
       654 
662 
     | 
    
         | 
| 
       655 
663 
     | 
    
         
             
                private
         
     | 
| 
       656 
664 
     | 
    
         | 
    
        data/lib/X11/form.rb
    CHANGED
    
    | 
         @@ -694,6 +694,13 @@ module X11 
     | 
|
| 
       694 
694 
     | 
    
         
             
                  field :width, Uint16
         
     | 
| 
       695 
695 
     | 
    
         
             
                  field :height, Uint16
         
     | 
| 
       696 
696 
     | 
    
         
             
                end
         
     | 
| 
      
 697 
     | 
    
         
            +
                
         
     | 
| 
      
 698 
     | 
    
         
            +
                class FreePixmap < BaseForm
         
     | 
| 
      
 699 
     | 
    
         
            +
                  field :opcode, Uint8, value: 54
         
     | 
| 
      
 700 
     | 
    
         
            +
                  unused 1
         
     | 
| 
      
 701 
     | 
    
         
            +
                  field :request_length, Uint16, value: 2
         
     | 
| 
      
 702 
     | 
    
         
            +
                  field :pixmap, Pixmap
         
     | 
| 
      
 703 
     | 
    
         
            +
                end
         
     | 
| 
       697 
704 
     | 
    
         | 
| 
       698 
705 
     | 
    
         
             
                class Str < BaseForm
         
     | 
| 
       699 
706 
     | 
    
         
             
                  field :name, Uint8, :length, value: ->(str) { str.name.length }
         
     | 
| 
         @@ -875,18 +882,18 @@ module X11 
     | 
|
| 
       875 
882 
     | 
    
         
             
                # FIXME: Events have quite a bit of redundancy, but unfortunately
         
     | 
| 
       876 
883 
     | 
    
         
             
                # BaseForm can't handle subclassing well.
         
     | 
| 
       877 
884 
     | 
    
         | 
| 
       878 
     | 
    
         
            -
                Shift 
     | 
| 
       879 
     | 
    
         
            -
                Lock 
     | 
| 
       880 
     | 
    
         
            -
                Control =  
     | 
| 
       881 
     | 
    
         
            -
                Mod1 
     | 
| 
       882 
     | 
    
         
            -
                Mod2 
     | 
| 
       883 
     | 
    
         
            -
                Mod3 
     | 
| 
       884 
     | 
    
         
            -
                Mod4 
     | 
| 
       885 
     | 
    
         
            -
                Mod5 
     | 
| 
       886 
     | 
    
         
            -
                Button1 =  
     | 
| 
       887 
     | 
    
         
            -
                Button2 =  
     | 
| 
       888 
     | 
    
         
            -
                Button3 =  
     | 
| 
       889 
     | 
    
         
            -
                Button4 =  
     | 
| 
      
 885 
     | 
    
         
            +
                Shift   = 0x0001
         
     | 
| 
      
 886 
     | 
    
         
            +
                Lock    = 0x0002
         
     | 
| 
      
 887 
     | 
    
         
            +
                Control = 0x0004
         
     | 
| 
      
 888 
     | 
    
         
            +
                Mod1    = 0x0008
         
     | 
| 
      
 889 
     | 
    
         
            +
                Mod2    = 0x0010
         
     | 
| 
      
 890 
     | 
    
         
            +
                Mod3    = 0x0020
         
     | 
| 
      
 891 
     | 
    
         
            +
                Mod4    = 0x0040
         
     | 
| 
      
 892 
     | 
    
         
            +
                Mod5    = 0x0080
         
     | 
| 
      
 893 
     | 
    
         
            +
                Button1 = 0x0100
         
     | 
| 
      
 894 
     | 
    
         
            +
                Button2 = 0x0200
         
     | 
| 
      
 895 
     | 
    
         
            +
                Button3 = 0x0400
         
     | 
| 
      
 896 
     | 
    
         
            +
                Button4 = 0x0800
         
     | 
| 
       890 
897 
     | 
    
         
             
                Button5 = 0x1000
         
     | 
| 
       891 
898 
     | 
    
         | 
| 
       892 
899 
     | 
    
         
             
                class Event < BaseForm
         
     | 
| 
         @@ -1217,5 +1224,12 @@ module X11 
     | 
|
| 
       1217 
1224 
     | 
    
         
             
                   field :fill, Uint32
         
     | 
| 
       1218 
1225 
     | 
    
         
             
                   field :color, XRenderColor
         
     | 
| 
       1219 
1226 
     | 
    
         
             
                 end
         
     | 
| 
      
 1227 
     | 
    
         
            +
             
     | 
| 
      
 1228 
     | 
    
         
            +
                 class XRenderFreePicture < BaseForm
         
     | 
| 
      
 1229 
     | 
    
         
            +
                   field :req_type, Uint8
         
     | 
| 
      
 1230 
     | 
    
         
            +
                   field :render_req_type, Uint8, value: 7
         
     | 
| 
      
 1231 
     | 
    
         
            +
                   field :request_length, Uint16, value: 2
         
     | 
| 
      
 1232 
     | 
    
         
            +
                   field :picture, Uint32
         
     | 
| 
      
 1233 
     | 
    
         
            +
                 end
         
     | 
| 
       1220 
1234 
     | 
    
         
             
              end
         
     | 
| 
       1221 
1235 
     | 
    
         
             
            end
         
     | 
    
        data/lib/X11/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pure-x11
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.11
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Vidar Hokstad
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2025-03-25 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       14 
14 
     | 
    
         
             
            description: Pure Ruby X11 bindings
         
     | 
| 
       15 
15 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -19,6 +19,7 @@ extensions: [] 
     | 
|
| 
       19 
19 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       20 
20 
     | 
    
         
             
            files:
         
     | 
| 
       21 
21 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
      
 22 
     | 
    
         
            +
            - CLAUDE.md
         
     | 
| 
       22 
23 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       23 
24 
     | 
    
         
             
            - Gemfile.lock
         
     | 
| 
       24 
25 
     | 
    
         
             
            - LICENSE.txt
         
     |