Class: Wmadd::X::Display
- Inherits:
-
Object
- Object
- Wmadd::X::Display
- Defined in:
- lib/wmadd/x.rb
Instance Attribute Summary collapse
-
#display ⇒ Object
readonly
Returns the value of attribute display.
Instance Method Summary collapse
- #default_root_window ⇒ Object
- #default_screen ⇒ Object
- #flush ⇒ Object
- #height(screen) ⇒ Object
-
#initialize(display = nil) ⇒ Display
constructor
A new instance of Display.
- #intern_atom(sym, f = 0) ⇒ Object
- #load_font(font) ⇒ Object
- #next_event ⇒ Object
- #width(screen) ⇒ Object
- #wm_window_types ⇒ Object
Constructor Details
Instance Attribute Details
#display ⇒ Object (readonly)
Returns the value of attribute display.
361 362 363 |
# File 'lib/wmadd/x.rb', line 361 def display @display end |
Instance Method Details
#default_root_window ⇒ Object
381 382 383 |
# File 'lib/wmadd/x.rb', line 381 def default_root_window Window.new(self, X11::XDefaultRootWindow(@display)) end |
#default_screen ⇒ Object
369 370 371 |
# File 'lib/wmadd/x.rb', line 369 def default_screen X11::DefaultScreen(@display) end |
#flush ⇒ Object
385 386 387 |
# File 'lib/wmadd/x.rb', line 385 def flush X11::XFlush(@display) end |
#height(screen) ⇒ Object
377 378 379 |
# File 'lib/wmadd/x.rb', line 377 def height(screen) X11::DisplayHeight(@display, screen) end |
#intern_atom(sym, f = 0) ⇒ Object
425 426 427 |
# File 'lib/wmadd/x.rb', line 425 def intern_atom(sym, f=0) X11::XInternAtom(@display, sym.to_s, f) end |
#load_font(font) ⇒ Object
389 390 391 |
# File 'lib/wmadd/x.rb', line 389 def load_font(font) X11::XLoadFont(@display, font) end |
#next_event ⇒ Object
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 |
# File 'lib/wmadd/x.rb', line 393 def next_event ev_buf = ' ' * 8 * 24 ev_ptr = Fiddle::Pointer[ev_buf] while true X11::XNextEvent(@display, ev_ptr) ev_type = ev_buf.unpack1('i') case ev_type when CREATE_NOTIFY return CreateWindowEvent.new(**X11::XCreateWindowEvent.new(ev_ptr).to_h) when CONFIGURE_NOTIFY return ConfigureEvent.new(**X11::XConfigureEvent.new(ev_ptr).to_h) when EXPOSE return ExposeEvent.new(**X11::XExposeEvent.new(ev_ptr).to_h) when PROPERTY_NOTIFY return PropertyEvent.new(**X11::XPropertyEvent.new(ev_ptr).to_h) end end end |
#width(screen) ⇒ Object
373 374 375 |
# File 'lib/wmadd/x.rb', line 373 def width(screen) X11::DisplayWidth(@display, screen) end |
#wm_window_types ⇒ Object
412 413 414 415 416 417 418 419 420 421 422 423 |
# File 'lib/wmadd/x.rb', line 412 def wm_window_types @wm_window_types ||= { X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_DESKTOP', 0) => :desktop, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_DOCK', 0) => :dock, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_TOOLBAR', 0) => :toolbar, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_MENU', 0) => :menu, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_UTILITY', 0) => :utility, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_SPLASH', 0) => :splash, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_DIALOG', 0) => :dialog, X11::XInternAtom(@display, '_NET_WM_WINDOW_TYPE_NORMAL', 0) => :normal, } end |