uh 2.0.0.pre → 2.0.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fac46367eac28fe3f697da45b08ed7250a5f8ac
4
- data.tar.gz: 6d68b1ac9b0627154a98715662a3dd686b4d91b7
3
+ metadata.gz: 2fc046078c7d4c3b9c91826b14cacb8c114820ae
4
+ data.tar.gz: 7f0f09757ee40f4c5dc5f8f303a6bee3f8fb342e
5
5
  SHA512:
6
- metadata.gz: 1009fe21fd3c74988921ae694ea8aff50c953d6777a5ba629dc5a256789aa12b097ec8879099032c4879470bb248dd70dbe9950cf81c146bac9beae2bc951387
7
- data.tar.gz: 0ff9b73c6acc2475c794f25e05c01626a20859f74da948af929865062b28512bdd975d6de9b0c41ac59653170c21ee5fd92565d5b96572d7abe8377b5f565bc1
6
+ metadata.gz: b7d9e2e8aa2a75f4332e2a17851f651ae1759336c0aaa88f216f7290d8d9dd2b2756e13a2e08b271d19b034163eb3044791e60560202fe3b301fa674d83ccd4a
7
+ data.tar.gz: c61bc88493bdf8d047f5b88a6d47b91ef034eb9fb54b01954aaa706c00b6358062bf91c7abcf1f3c6babb539306bc7a4ae0240f3884d80232fc996633c469c48
data/ext/uh/uh.c CHANGED
@@ -123,8 +123,10 @@ void uh_window() {
123
123
  rb_define_method(cWindow, "focus", window_focus, 0);
124
124
  rb_define_method(cWindow, "kill", window_kill, 0);
125
125
  rb_define_method(cWindow, "map", window_map, 0);
126
+ rb_define_method(cWindow, "mask", window_mask, 0);
126
127
  rb_define_method(cWindow, "mask=", window_mask_set, 1);
127
128
  rb_define_method(cWindow, "name", window_name, 0);
129
+ rb_define_method(cWindow, "name=", window_name_set, 1);
128
130
  rb_define_method(cWindow, "override_redirect?", window_override_redirect, 0);
129
131
  rb_define_method(cWindow, "raise", window_raise, 0);
130
132
  rb_define_method(cWindow, "unmap", window_unmap, 0);
@@ -134,6 +136,7 @@ void uh_window() {
134
136
  rb_define_private_method(cWindow, "_configure", window__configure, 4);
135
137
  rb_define_private_method(cWindow, "_configure_event",
136
138
  window__configure_event, 4);
139
+ rb_define_private_method(cWindow, "_create", window__create, 4);
137
140
  rb_define_private_method(cWindow, "_create_sub", window__create_sub, 4);
138
141
  rb_define_private_method(cWindow, "_moveresize", window__moveresize, 4);
139
142
  }
data/ext/uh/uh.h CHANGED
@@ -85,14 +85,17 @@ VALUE window_icccm_wm_delete(VALUE self);
85
85
  VALUE window_icccm_wm_protocols(VALUE self);
86
86
  VALUE window_kill(VALUE self);
87
87
  VALUE window_map(VALUE self);
88
+ VALUE window_mask(VALUE self);
88
89
  VALUE window_mask_set(VALUE self, VALUE mask);
89
90
  VALUE window_name(VALUE self);
91
+ VALUE window_name_set(VALUE self, VALUE name);
90
92
  VALUE window_override_redirect(VALUE self);
91
93
  VALUE window_raise(VALUE self);
92
94
  VALUE window_unmap(VALUE self);
93
95
  VALUE window_wclass(VALUE self);
94
96
  VALUE window__configure(VALUE self, VALUE rx, VALUE ry, VALUE rw, VALUE rh);
95
97
  VALUE window__configure_event(VALUE self, VALUE rx, VALUE ry, VALUE rw, VALUE rh);
98
+ VALUE window__create(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h);
96
99
  VALUE window__create_sub(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h);
97
100
  VALUE window__moveresize(VALUE self, VALUE x, VALUE y, VALUE width, VALUE height);
98
101
  int window_id(VALUE window);
data/ext/uh/window.c CHANGED
@@ -68,6 +68,17 @@ VALUE window_map(VALUE self) {
68
68
  return Qnil;
69
69
  }
70
70
 
71
+ VALUE window_mask(VALUE self) {
72
+ XWindowAttributes wa;
73
+ SET_WINDOW(self);
74
+
75
+ if (!XGetWindowAttributes(DPY, WINDOW, &wa)) {
76
+ rb_raise(rb_eArgError, "cannot get window attributes for `0x%08lx'", WINDOW);
77
+ }
78
+
79
+ return LONG2FIX(wa.your_event_mask);
80
+ }
81
+
71
82
  VALUE window_mask_set(VALUE self, VALUE mask) {
72
83
  XSetWindowAttributes attrs;
73
84
  SET_WINDOW(self);
@@ -92,6 +103,14 @@ VALUE window_name(VALUE self) {
92
103
  return wname;
93
104
  }
94
105
 
106
+ VALUE window_name_set(VALUE self, VALUE name) {
107
+ SET_WINDOW(self);
108
+
109
+ XStoreName(DPY, WINDOW, RSTRING_PTR(name));
110
+
111
+ return Qnil;
112
+ }
113
+
95
114
  VALUE window_override_redirect(VALUE self) {
96
115
  XWindowAttributes wa;
97
116
  SET_WINDOW(self);
@@ -171,6 +190,18 @@ VALUE window__configure_event(VALUE self, VALUE rx, VALUE ry, VALUE rw, VALUE rh
171
190
  return Qnil;
172
191
  }
173
192
 
193
+ VALUE window__create(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) {
194
+ Window win;
195
+ SET_WINDOW(self);
196
+
197
+ win = XCreateSimpleWindow(DPY, WINDOW,
198
+ FIX2INT(x), FIX2INT(y), FIX2INT(w), FIX2INT(h),
199
+ 0, BlackPixel(DPY, SCREEN_DEFAULT), BlackPixel(DPY, SCREEN_DEFAULT)
200
+ );
201
+
202
+ return window_make(DPY, win);
203
+ }
204
+
174
205
  VALUE window__create_sub(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) {
175
206
  XSetWindowAttributes wa;
176
207
  Window sub_win;
data/lib/uh/display.rb CHANGED
@@ -4,6 +4,10 @@ module Uh
4
4
  ENV['DISPLAY']
5
5
  end
6
6
 
7
+ def create_window(geo)
8
+ root.create geo
9
+ end
10
+
7
11
  def create_subwindow(geo)
8
12
  root.create_sub geo
9
13
  end
data/lib/uh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uh
2
- VERSION = '2.0.0.pre'.freeze
2
+ VERSION = '2.0.0.pre1'.freeze
3
3
  end
data/lib/uh/window.rb CHANGED
@@ -18,6 +18,10 @@ module Uh
18
18
  self
19
19
  end
20
20
 
21
+ def create(geo)
22
+ _create geo.x, geo.y, geo.width, geo.height
23
+ end
24
+
21
25
  def create_sub(geo)
22
26
  _create_sub geo.x, geo.y, geo.width, geo.height
23
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre
4
+ version: 2.0.0.pre1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-09 00:00:00.000000000 Z
11
+ date: 2015-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -130,4 +130,3 @@ summary: Xlib simplified toolkit
130
130
  test_files:
131
131
  - test/test_helper.rb
132
132
  - test/uh/test_geo.rb
133
- has_rdoc: