uh 2.0.0.pre2 → 2.0.0.pre3
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/README.md +18 -0
- data/ext/uh/extconf.rb +1 -2
- data/lib/uh.rb +0 -6
- data/lib/uh/display.rb +16 -0
- data/lib/uh/version.rb +1 -1
- data/lib/uh/window.rb +0 -28
- metadata +24 -29
- data/.gitignore +0 -4
- data/.travis.yml +0 -7
- data/Gemfile +0 -5
- data/Guardfile +0 -7
- data/LICENSE +0 -30
- data/Rakefile +0 -13
- data/ext/uh/color.c +0 -12
- data/ext/uh/display.c +0 -242
- data/ext/uh/event.c +0 -168
- data/ext/uh/font.c +0 -14
- data/ext/uh/pixmap.c +0 -92
- data/ext/uh/screen.c +0 -12
- data/ext/uh/uh.c +0 -143
- data/ext/uh/uh.h +0 -106
- data/ext/uh/window.c +0 -262
- data/lib/uh/drawable.rb +0 -7
- data/lib/uh/pixmap.rb +0 -5
- data/test/test_helper.rb +0 -19
- data/test/uh/test_geo.rb +0 -52
- data/uh.gemspec +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 822c274d968c118bede18ca1963d4581d57a50a7
|
4
|
+
data.tar.gz: 70602803d3ef15b5b3af601ae4fc770b606cc36e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 85142b605aac3ebbc9937d1a5243e8c4efaa32378fec1c356a410e39c7fd90c558d36d0beac3379cb160ca5777fcaa7e3109d5ce0ccc37e4eb4362c284c782eb
|
7
|
+
data.tar.gz: 87e3ae605479e288ecd2ae0d2ae75b4428bdac14515d7a94a3ebd7dd02d9df4ad494e25c2607455616fcfcc4d8af9b52cca1ebc76808d26efe3b77d312f94b3a
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
uh
|
2
|
+
==
|
3
|
+
|
4
|
+
[![Version ][badge-version-img]][badge-version-uri]
|
5
|
+
[![Build status ][badge-build-img]][badge-build-uri]
|
6
|
+
[![Code Climate ][badge-cclimate-img]][badge-cclimate-uri]
|
7
|
+
|
8
|
+
|
9
|
+
Minimalistic Xlib toolkit.
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
[badge-version-img]: https://img.shields.io/gem/v/uh.svg?style=flat-square
|
14
|
+
[badge-version-uri]: https://rubygems.org/gems/uh
|
15
|
+
[badge-build-img]: https://img.shields.io/travis/tjouan/uh/master.svg?style=flat-square
|
16
|
+
[badge-build-uri]: https://travis-ci.org/tjouan/uh
|
17
|
+
[badge-cclimate-img]: https://img.shields.io/codeclimate/github/tjouan/uh.svg?style=flat-square
|
18
|
+
[badge-cclimate-uri]: https://codeclimate.com/github/tjouan/uh
|
data/ext/uh/extconf.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'mkmf'
|
2
2
|
|
3
|
-
fail
|
4
|
-
fail 'libXinerama is required' unless have_library 'Xinerama'
|
3
|
+
%w[X11 Xinerama].each { |e| fail "lib#{e} is required" unless have_library e }
|
5
4
|
|
6
5
|
$CFLAGS << ' -std=c99 -Wall'
|
7
6
|
if %w[DEBUG VALGRIND].any? { |e| ENV.key? e }
|
data/lib/uh.rb
CHANGED
@@ -1,21 +1,15 @@
|
|
1
1
|
require 'uh/uh'
|
2
2
|
require 'uh/display'
|
3
|
-
require 'uh/drawable'
|
4
3
|
require 'uh/events'
|
5
4
|
require 'uh/events/event'
|
6
5
|
require 'uh/font'
|
7
6
|
require 'uh/geo'
|
8
7
|
require 'uh/geo_accessors'
|
9
|
-
require 'uh/pixmap'
|
10
8
|
require 'uh/screen'
|
11
9
|
require 'uh/version'
|
12
10
|
require 'uh/window'
|
13
11
|
|
14
12
|
module Uh
|
15
|
-
Error = Class.new(StandardError)
|
16
|
-
RuntimeError = Class.new(RuntimeError)
|
17
|
-
ArgumentError = Class.new(Error)
|
18
|
-
|
19
13
|
KEY_MODIFIERS = {
|
20
14
|
shift: 1 << 0,
|
21
15
|
lock: 1 << 1,
|
data/lib/uh/display.rb
CHANGED
@@ -4,6 +4,18 @@ module Uh
|
|
4
4
|
ENV['DISPLAY']
|
5
5
|
end
|
6
6
|
|
7
|
+
def check!
|
8
|
+
fail DisplayError, 'display not opened' unless opened?
|
9
|
+
end
|
10
|
+
|
11
|
+
def color_by_name(color_name)
|
12
|
+
Color.new(self, color_name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_pixmap(width, height)
|
16
|
+
Pixmap.new(self, width, height)
|
17
|
+
end
|
18
|
+
|
7
19
|
def create_window(geo)
|
8
20
|
root.create geo
|
9
21
|
end
|
@@ -19,5 +31,9 @@ module Uh
|
|
19
31
|
def pending?
|
20
32
|
pending > 0
|
21
33
|
end
|
34
|
+
|
35
|
+
def query_font
|
36
|
+
Font.new(self)
|
37
|
+
end
|
22
38
|
end
|
23
39
|
end
|
data/lib/uh/version.rb
CHANGED
data/lib/uh/window.rb
CHANGED
@@ -7,33 +7,5 @@ module Uh
|
|
7
7
|
def ==(other)
|
8
8
|
id == other.id
|
9
9
|
end
|
10
|
-
|
11
|
-
def configure(geo)
|
12
|
-
_configure geo.x, geo.y, geo.width, geo.height
|
13
|
-
self
|
14
|
-
end
|
15
|
-
|
16
|
-
def configure_event(geo)
|
17
|
-
_configure_event geo.x, geo.y, geo.width, geo.height
|
18
|
-
self
|
19
|
-
end
|
20
|
-
|
21
|
-
def create(geo)
|
22
|
-
_create geo.x, geo.y, geo.width, geo.height
|
23
|
-
end
|
24
|
-
|
25
|
-
def create_sub(geo)
|
26
|
-
_create_sub geo.x, geo.y, geo.width, geo.height
|
27
|
-
end
|
28
|
-
|
29
|
-
def moveresize(geo)
|
30
|
-
_moveresize geo.x, geo.y, geo.width, geo.height
|
31
|
-
self
|
32
|
-
end
|
33
|
-
|
34
|
-
def show
|
35
|
-
map
|
36
|
-
self
|
37
|
-
end
|
38
10
|
end
|
39
11
|
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.
|
4
|
+
version: 2.0.0.pre3
|
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-
|
11
|
+
date: 2015-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5.
|
47
|
+
version: '5.6'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5.
|
54
|
+
version: '5.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest-reporters
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,46 +66,43 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: headless
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.0'
|
69
83
|
description: uh
|
70
84
|
email: tj@a13.fr
|
71
85
|
executables: []
|
72
86
|
extensions:
|
73
87
|
- ext/uh/extconf.rb
|
74
|
-
extra_rdoc_files:
|
88
|
+
extra_rdoc_files:
|
89
|
+
- README.md
|
75
90
|
files:
|
76
|
-
-
|
77
|
-
- ".travis.yml"
|
78
|
-
- Gemfile
|
79
|
-
- Guardfile
|
80
|
-
- LICENSE
|
81
|
-
- Rakefile
|
82
|
-
- ext/uh/color.c
|
83
|
-
- ext/uh/display.c
|
84
|
-
- ext/uh/event.c
|
91
|
+
- README.md
|
85
92
|
- ext/uh/extconf.rb
|
86
|
-
- ext/uh/font.c
|
87
|
-
- ext/uh/pixmap.c
|
88
|
-
- ext/uh/screen.c
|
89
|
-
- ext/uh/uh.c
|
90
|
-
- ext/uh/uh.h
|
91
|
-
- ext/uh/window.c
|
92
93
|
- lib/uh.rb
|
93
94
|
- lib/uh/display.rb
|
94
|
-
- lib/uh/drawable.rb
|
95
95
|
- lib/uh/events.rb
|
96
96
|
- lib/uh/events/event.rb
|
97
97
|
- lib/uh/font.rb
|
98
98
|
- lib/uh/geo.rb
|
99
99
|
- lib/uh/geo_accessors.rb
|
100
|
-
- lib/uh/pixmap.rb
|
101
100
|
- lib/uh/screen.rb
|
102
101
|
- lib/uh/version.rb
|
103
102
|
- lib/uh/window.rb
|
104
|
-
- test/test_helper.rb
|
105
|
-
- test/uh/test_geo.rb
|
106
|
-
- uh.gemspec
|
107
103
|
homepage: https://rubygems.org/gems/uh
|
108
|
-
licenses:
|
104
|
+
licenses:
|
105
|
+
- BSD-3-Clause
|
109
106
|
metadata: {}
|
110
107
|
post_install_message:
|
111
108
|
rdoc_options: []
|
@@ -127,6 +124,4 @@ rubygems_version: 2.4.5
|
|
127
124
|
signing_key:
|
128
125
|
specification_version: 4
|
129
126
|
summary: Xlib simplified toolkit
|
130
|
-
test_files:
|
131
|
-
- test/test_helper.rb
|
132
|
-
- test/uh/test_geo.rb
|
127
|
+
test_files: []
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Guardfile
DELETED
data/LICENSE
DELETED
@@ -1,30 +0,0 @@
|
|
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.
|
data/Rakefile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'rake/extensiontask'
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
task default: :test
|
5
|
-
|
6
|
-
Rake::ExtensionTask.new('uh') do |t|
|
7
|
-
t.lib_dir = 'lib/uh'
|
8
|
-
end
|
9
|
-
|
10
|
-
Rake::TestTask.new(test: :compile) do |t|
|
11
|
-
t.libs << 'lib' << 'test'
|
12
|
-
t.pattern = 'test/**/test_*.rb'
|
13
|
-
end
|
data/ext/uh/color.c
DELETED
data/ext/uh/display.c
DELETED
@@ -1,242 +0,0 @@
|
|
1
|
-
#include "uh.h"
|
2
|
-
|
3
|
-
|
4
|
-
#define SET_DISPLAY(x) \
|
5
|
-
UhDisplay *display;\
|
6
|
-
Data_Get_Struct(x, UhDisplay, display);
|
7
|
-
|
8
|
-
#define DPY display->dpy
|
9
|
-
|
10
|
-
|
11
|
-
VALUE rdisplay_error_handler = Qnil;
|
12
|
-
|
13
|
-
int display_x_error_handler(Display *dpy, XErrorEvent *e);
|
14
|
-
|
15
|
-
|
16
|
-
VALUE display_s_on_error(VALUE klass) {
|
17
|
-
if (!rb_block_given_p()) {
|
18
|
-
rb_raise(rb_eArgError, "no block given");
|
19
|
-
}
|
20
|
-
|
21
|
-
rdisplay_error_handler = rb_block_proc();
|
22
|
-
rb_global_variable(&rdisplay_error_handler);
|
23
|
-
|
24
|
-
return Qnil;
|
25
|
-
}
|
26
|
-
|
27
|
-
|
28
|
-
VALUE display_alloc(VALUE klass) {
|
29
|
-
UhDisplay *display;
|
30
|
-
|
31
|
-
return Data_Make_Struct(klass, UhDisplay, 0, free, display);
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
VALUE display_close(VALUE self) {
|
36
|
-
SET_DISPLAY(self);
|
37
|
-
|
38
|
-
if (DPY) {
|
39
|
-
XCloseDisplay(DPY);
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
rb_raise(eDisplayError, "cannot close display");
|
43
|
-
}
|
44
|
-
|
45
|
-
return self;
|
46
|
-
}
|
47
|
-
|
48
|
-
VALUE display_color_by_name(VALUE self, VALUE rcolor) {
|
49
|
-
Colormap map;
|
50
|
-
XColor color;
|
51
|
-
SET_DISPLAY(self);
|
52
|
-
|
53
|
-
map = DefaultColormap(DPY, SCREEN_DEFAULT);
|
54
|
-
|
55
|
-
if (!XAllocNamedColor(DPY, map, RSTRING_PTR(rcolor), &color, &color))
|
56
|
-
rb_raise(rb_eArgError, "invalid color name `%s'", RSTRING_PTR(rcolor));
|
57
|
-
|
58
|
-
return color_make(color.pixel);
|
59
|
-
}
|
60
|
-
|
61
|
-
VALUE display_create_pixmap(VALUE self, VALUE width, VALUE height) {
|
62
|
-
Pixmap pixmap;
|
63
|
-
SET_DISPLAY(self);
|
64
|
-
|
65
|
-
pixmap = XCreatePixmap(DPY, ROOT_DEFAULT, FIX2INT(width), FIX2INT(height),
|
66
|
-
DefaultDepth(DPY, SCREEN_DEFAULT)
|
67
|
-
);
|
68
|
-
|
69
|
-
return pixmap_make(DPY, pixmap, width, height);
|
70
|
-
}
|
71
|
-
|
72
|
-
VALUE display_fileno(VALUE self) {
|
73
|
-
SET_DISPLAY(self);
|
74
|
-
|
75
|
-
return INT2FIX(XConnectionNumber(DPY));
|
76
|
-
}
|
77
|
-
|
78
|
-
VALUE display_flush(VALUE self) {
|
79
|
-
SET_DISPLAY(self);
|
80
|
-
|
81
|
-
return INT2FIX(XFlush(DPY));
|
82
|
-
}
|
83
|
-
|
84
|
-
VALUE display_each_event(VALUE self) {
|
85
|
-
XEvent xev;
|
86
|
-
SET_DISPLAY(self);
|
87
|
-
|
88
|
-
while (1) {
|
89
|
-
XNextEvent(DPY, &xev);
|
90
|
-
rb_yield(event_make(&xev));
|
91
|
-
}
|
92
|
-
|
93
|
-
return Qnil;
|
94
|
-
}
|
95
|
-
|
96
|
-
VALUE display_grab_key(VALUE self, VALUE key, VALUE modifier) {
|
97
|
-
KeySym ks;
|
98
|
-
KeyCode kc;
|
99
|
-
SET_DISPLAY(self);
|
100
|
-
|
101
|
-
ks = XStringToKeysym(RSTRING_PTR(key));
|
102
|
-
if (ks == NoSymbol)
|
103
|
-
rb_raise(rb_eArgError, "invalid KeySym %s", RSTRING_PTR(key));
|
104
|
-
|
105
|
-
kc = XKeysymToKeycode(DPY, ks);
|
106
|
-
if (kc == 0)
|
107
|
-
rb_raise(rb_eArgError, "keysym XK_%s has no keycode", RSTRING_PTR(key));
|
108
|
-
|
109
|
-
XGrabKey(DPY, kc, FIX2INT(modifier), ROOT_DEFAULT, True,
|
110
|
-
GrabModeAsync, GrabModeAsync);
|
111
|
-
|
112
|
-
return Qnil;
|
113
|
-
}
|
114
|
-
|
115
|
-
VALUE display_listen_events(int argc, VALUE *argv, VALUE self) {
|
116
|
-
VALUE arg1;
|
117
|
-
VALUE arg2;
|
118
|
-
Window window;
|
119
|
-
long mask;
|
120
|
-
SET_DISPLAY(self);
|
121
|
-
|
122
|
-
if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
|
123
|
-
window = window_id(arg1);
|
124
|
-
mask = FIX2LONG(arg2);
|
125
|
-
}
|
126
|
-
else {
|
127
|
-
window = ROOT_DEFAULT;
|
128
|
-
mask = FIX2LONG(arg1);
|
129
|
-
}
|
130
|
-
|
131
|
-
XSelectInput(DPY, window, mask);
|
132
|
-
|
133
|
-
return Qnil;
|
134
|
-
}
|
135
|
-
|
136
|
-
VALUE display_next_event(VALUE self) {
|
137
|
-
XEvent xev;
|
138
|
-
SET_DISPLAY(self);
|
139
|
-
|
140
|
-
XNextEvent(DPY, &xev);
|
141
|
-
|
142
|
-
return event_make(&xev);
|
143
|
-
}
|
144
|
-
|
145
|
-
VALUE display_open(VALUE self) {
|
146
|
-
SET_DISPLAY(self);
|
147
|
-
|
148
|
-
if (!(DPY = XOpenDisplay(NULL))) {
|
149
|
-
rb_raise(eDisplayError, "cannot open display");
|
150
|
-
}
|
151
|
-
|
152
|
-
XSetErrorHandler(display_x_error_handler);
|
153
|
-
|
154
|
-
return self;
|
155
|
-
}
|
156
|
-
|
157
|
-
VALUE display_pending(VALUE self) {
|
158
|
-
SET_DISPLAY(self);
|
159
|
-
|
160
|
-
return INT2FIX(XPending(DPY));
|
161
|
-
}
|
162
|
-
|
163
|
-
VALUE display_query_font(VALUE self) {
|
164
|
-
XFontStruct *xfs;
|
165
|
-
VALUE font;
|
166
|
-
SET_DISPLAY(self);
|
167
|
-
|
168
|
-
if (!(xfs = XQueryFont(DPY,
|
169
|
-
XGContextFromGC(DefaultGC(DPY, SCREEN_DEFAULT)))))
|
170
|
-
return Qnil;
|
171
|
-
|
172
|
-
font = font_make(xfs->max_bounds.width, xfs->ascent, xfs->descent);
|
173
|
-
XFreeFontInfo(NULL, xfs, 1);
|
174
|
-
|
175
|
-
return font;
|
176
|
-
}
|
177
|
-
|
178
|
-
VALUE display_root(VALUE self) {
|
179
|
-
SET_DISPLAY(self);
|
180
|
-
|
181
|
-
return window_make(DPY, ROOT_DEFAULT);
|
182
|
-
}
|
183
|
-
|
184
|
-
VALUE display_screens(VALUE self) {
|
185
|
-
XineramaScreenInfo *xsi;
|
186
|
-
int n;
|
187
|
-
VALUE screens = rb_ary_new();
|
188
|
-
VALUE args[5];
|
189
|
-
SET_DISPLAY(self);
|
190
|
-
|
191
|
-
if (XineramaIsActive(DPY)) {
|
192
|
-
xsi = XineramaQueryScreens(DPY, &n);
|
193
|
-
|
194
|
-
for (int i = 0; i < n; i++) {
|
195
|
-
args[0] = INT2FIX(i);
|
196
|
-
args[1] = INT2FIX(xsi[i].x_org);
|
197
|
-
args[2] = INT2FIX(xsi[i].y_org);
|
198
|
-
args[3] = INT2FIX(xsi[i].width);
|
199
|
-
args[4] = INT2FIX(xsi[i].height);
|
200
|
-
|
201
|
-
rb_ary_push(screens, rb_class_new_instance(5, args, cScreen));
|
202
|
-
}
|
203
|
-
}
|
204
|
-
else {
|
205
|
-
args[0] = INT2FIX(SCREEN_DEFAULT);
|
206
|
-
args[1] = INT2FIX(0);
|
207
|
-
args[2] = INT2FIX(0);
|
208
|
-
args[3] = INT2FIX(XDisplayWidth(DPY, SCREEN_DEFAULT));
|
209
|
-
args[4] = INT2FIX(XDisplayHeight(DPY, SCREEN_DEFAULT));
|
210
|
-
|
211
|
-
rb_ary_push(screens, rb_class_new_instance(5, args, cScreen));
|
212
|
-
}
|
213
|
-
|
214
|
-
return screens;
|
215
|
-
}
|
216
|
-
|
217
|
-
VALUE display_sync(VALUE self, VALUE discard) {
|
218
|
-
SET_DISPLAY(self);
|
219
|
-
|
220
|
-
XSync(display->dpy, RTEST(discard));
|
221
|
-
|
222
|
-
return Qnil;
|
223
|
-
}
|
224
|
-
|
225
|
-
|
226
|
-
int display_x_error_handler(Display *dpy, XErrorEvent *e) {
|
227
|
-
char msg[80];
|
228
|
-
char req[80];
|
229
|
-
char nb[80];
|
230
|
-
|
231
|
-
XGetErrorText(dpy, e->error_code, msg, sizeof msg);
|
232
|
-
sprintf(nb, "%d", e->request_code);
|
233
|
-
XGetErrorDatabaseText(dpy, "XRequest", nb, "<unknown>", req, sizeof req);
|
234
|
-
|
235
|
-
rb_funcall(rdisplay_error_handler, rb_intern("call"), 3,
|
236
|
-
rb_str_new_cstr(req),
|
237
|
-
LONG2NUM(e->resourceid),
|
238
|
-
rb_str_new_cstr(msg)
|
239
|
-
);
|
240
|
-
|
241
|
-
return 0;
|
242
|
-
}
|