Giter Site home page Giter Site logo

ruby-xlib-objects's People

Contributors

christopheraue avatar liger1978 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ruby-xlib-objects's Issues

Pointer Functionality

I was trying to query and reposition the pointer but I could not find any implementation in the xlib-objects gem. Did I miss it?

What I want to do, I achieved using xlib but I'd prefer to use the cleaner object layer if support exists:

class IntPtr < FFI::Struct
    layout  :value, :int
end
display = XlibObj::Display.new(':0')
root_window = Xlib.XRootWindow(display.to_native,0)
Xlib.XQueryPointer(display.to_native,
                   root_window,
                   IntPtr.new,
                   IntPtr.new,
                   mx = IntPtr.new,
                   my = IntPtr.new,
                   IntPtr.new,
                   IntPtr.new,
                   IntPtr.new)
Xlib.XWarpPointer(display.to_native,
                  Xlib::None,
                  root_window,
                  0, 0,
                  0, 0,
                  x, 10)
display.flush

Also, I want to submit a mouse click. I want to implement this Python code in Ruby:

from Xlib.ext.xtest import fake_input
fake_input(display,X.ButtonPress,1, X.CurrentTime, X.NONE, x, 10)

which uses the XTest extension. I don't think you have support for that but I thought I'd ask. I am working around the problem by using xdotool but I'd prefer to do it directly.

%x(xdotool click 1)

I've spent a few hours today (well, all day really!), first trying to write native Xlib code and then looking for libraries and trying to fix up a FFI binding to libxtst and libxdo. However, it's messy and I've fallen back to the above one-liner for the time being.

Not compatible with Ruby 2.0

The gem claims to be compatible with any version of Ruby but is actually only compatible with Ruby >=2.1, due to use of "required keyword arguments":

require "xlib-objects"
SyntaxError: /usr/local/share/gems/gems/xlib-objects-0.7.6/lib/event/selection_notify.rb:12: syntax error, unexpected ','
      def initialize(type:, target:, property:)

Xlib Window property setting

Hi, Thanks for this great library, It really was a godsend today!

This is just some feedback for you because what I wanted to do ended up being a little obscure. I wanted to set a property on a window in a Gtk application. I tried this:

topw.property('_NET_WM_STRUT').set([0, 0, self.height, 0 ], :CARDINAL)

However that didn't work because topw.property returns nil if the property isn't set. I ended up doing the work of XlibObj::WIndow::Property myself:

XlibObj::Window::Property.new(topw, '_NET_WM_STRUT').set(
            [0, 0, self.height, 0 ],
            :CARDINAL)

My full code snippet, for the benefit of others,

topw = XlibObj::Window.new(XlibObj::Display.new(':0'), toplevel.window.xid)
XlibObj::Window::Property.new(topw, '_NET_WM_STRUT').set(
            [0, 0, self.height, 0 ],
            :CARDINAL)
XlibObj::Window::Property.new(topw, '_NET_WM_STRUT_PARTIAL').set(
            [0, 0, self.height, 0, 0, 0, 0, 0, x, x+width-1, 0, 0], 
            :CARDINAL)

That first line gives me a Xlib window object for a Gtk window object. I don't know if there's a cleaner way to achieve that!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.