uh 1.2.0 → 1.2.1

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: b3eb8222bf5b29246e0eac8a58b1f0e8de6efdf5
4
- data.tar.gz: cf5c424c0a9abe939de622784f1c12d4ca4dbfc6
3
+ metadata.gz: eb111523e35ca986f1df0008b339407efb803964
4
+ data.tar.gz: a42b77c2d47c94a889990ffaed2229afc97f26d3
5
5
  SHA512:
6
- metadata.gz: a70291650ca1a090d0993c4c6d4b7189db8159b685ec45c306d026745b7a62ab5f0151cc9bbf1e771fb57b371c58a8e1f8c6e1796852f9545562df3a335a3245
7
- data.tar.gz: 40ebaee33dd8654e8dd3b9009d848e85d6e7fa41e368f62309d6a7a4911459f20cf36f121a27fb64b103b7fb9ef9d2b6a6529f23852c63ebcfe7e33f933191c4
6
+ metadata.gz: 40d6ad54516a7c74a2310dd4efc16041d9c5c4f7a0b00673837f15d842ce27724418d79ade120f28385e7c1ddae3ed0f36132f94c5df6a20627440aafbe2dda0
7
+ data.tar.gz: 8a20c4f547461632eaf7a609e805ce43c154045c2e0dd00c535c135a17f8803629b538caadb7882cf50045f01d6d55c34edd82d2d53a00ebe9390f65b78ceed8
data/LICENSE ADDED
@@ -0,0 +1,30 @@
1
+ Copyright 2014 Thibault Jouan. All rights reserved.
2
+
3
+ Redistribution and use in source and binary forms, with or without
4
+ modification, are permitted provided that the following conditions are
5
+ met:
6
+
7
+ * Redistributions of source code must retain the above copyright
8
+ notice, this list of conditions and the following disclaimer.
9
+
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in
12
+ the documentation and/or other materials provided with the
13
+ distribution.
14
+
15
+ * Neither the name of the software nor the names of its contributors
16
+ may be used to endorse or promote products derived from this
17
+ software without specific prior written permission.
18
+
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS "AS IS" AND
21
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS
24
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27
+ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
29
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
30
+ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -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
  }
@@ -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);
@@ -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;
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Uh
2
- VERSION = '1.2.0'.freeze
2
+ VERSION = '1.2.1'.freeze
3
3
  end
@@ -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: 1.2.0
4
+ version: 1.2.1
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-06 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
@@ -77,6 +77,7 @@ files:
77
77
  - ".travis.yml"
78
78
  - Gemfile
79
79
  - Guardfile
80
+ - LICENSE
80
81
  - Rakefile
81
82
  - ext/uh/color.c
82
83
  - ext/uh/display.c