author | Radek Brich <radek.brich@devl.cz> |
Sun, 27 Jan 2013 12:54:52 +0100 | |
changeset 69 | 4e7be77bafff |
parent 67 | 71f60bf6ebb7 |
child 71 | cfd3445107b4 |
permissions | -rw-r--r-- |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
1 |
# distutils: language = c++ |
69
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
2 |
# distutils: sources = sdlterm/src/sdlterm.cc |
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
3 |
# distutils: include_dirs = /usr/include/SDL sdlterm/src |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
4 |
# distutils: libraries = SDL SDL_ttf |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
5 |
# distutils: define_macros = _GNU_SOURCE=1 _REENTRANT |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
6 |
# distutils: extra_compile_args = --std=c++11 |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
7 |
# cython: language_level=3 |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
8 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
9 |
from libcpp cimport bool |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
10 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
11 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
12 |
cdef extern from "sdlterm.h": |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
13 |
cdef struct Event_key: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
14 |
char *keyname |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
15 |
Py_UNICODE unicode |
67
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
16 |
int mod |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
17 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
18 |
cdef struct Event_mouse: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
19 |
int x, y |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
20 |
int button |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
21 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
22 |
cdef struct Event: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
23 |
# enum |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
24 |
int QUIT |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
25 |
int RESIZE |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
26 |
int KEYPRESS |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
27 |
int MOUSEDOWN |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
28 |
int MOUSEUP |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
29 |
int MOUSEMOVE |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
30 |
int MOUSEWHEEL |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
31 |
|
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
32 |
int type |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
33 |
Event_key key |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
34 |
Event_mouse mouse |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
35 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
36 |
cdef cppclass Terminal: |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
37 |
Terminal() except + |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
38 |
|
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
39 |
void select_font(char *fname_regular, char *fname_bold, int ptsize) except + |
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
40 |
void resize(int pxwidth, int pxheight) except + |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
41 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
42 |
void erase() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
43 |
void putch(int x, int y, Py_UNICODE ch) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
44 |
void commit() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
45 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
46 |
int prepare_attr(int fg, int bg, int style) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
47 |
void set_attr(int value) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
48 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
49 |
void show_cursor(int x, int y) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
50 |
void hide_cursor() |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
51 |
|
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
52 |
bool wait_event(Event event, int timeout) except + |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
53 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
54 |
int get_width() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
55 |
int get_height() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
56 |
|
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
57 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
58 |
cdef class SDLTerminal: |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
59 |
cdef Terminal *thisptr # hold a C++ instance which we're wrapping |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
60 |
cdef Event event |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
61 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
62 |
def __cinit__(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
63 |
self.thisptr = new Terminal() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
64 |
def __dealloc__(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
65 |
del self.thisptr |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
66 |
|
54
86b84535726e
DriverSDL: system font lookup.
Radek Brich <radek.brich@devl.cz>
parents:
53
diff
changeset
|
67 |
def select_font(self, bytes fname_regular, bytes fname_bold, int ptsize): |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
68 |
self.thisptr.select_font(fname_regular, fname_bold, ptsize) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
69 |
def resize(self, width, height): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
70 |
self.thisptr.resize(width, height) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
71 |
|
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
72 |
def erase(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
73 |
self.thisptr.erase() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
74 |
def putch(self, x, y, ch): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
75 |
self.thisptr.putch(x, y, ch) |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
76 |
def commit(self): |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
77 |
self.thisptr.commit() |
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
78 |
|
50
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
79 |
def prepare_attr(self, fg, bg, style): |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
80 |
return self.thisptr.prepare_attr(fg, bg, style) |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
81 |
def set_attr(self, value): |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
82 |
self.thisptr.set_attr(value) |
c5b8b9d2da95
DriverSDL: Implement colors.
Radek Brich <radek.brich@devl.cz>
parents:
49
diff
changeset
|
83 |
|
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
84 |
def show_cursor(self, x, y): |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
85 |
self.thisptr.show_cursor(x, y) |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
86 |
def hide_cursor(self): |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
87 |
self.thisptr.hide_cursor() |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
88 |
|
69
4e7be77bafff
Add sdlterm to setup.py. Simplify color description, allow missing bg.
Radek Brich <radek.brich@devl.cz>
parents:
67
diff
changeset
|
89 |
def wait_event(self, timeout=None): |
57
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
90 |
if not self.thisptr.wait_event(self.event, timeout or 0): |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
91 |
# timeout |
911927edbdde
DriverSDL: Add support for timeouts.
Radek Brich <radek.brich@devl.cz>
parents:
55
diff
changeset
|
92 |
return None |
49
1611c462c3e3
Update sdlterm: Optimize commit() - use two cell buffers, redraw only dirty cells, not everything. Fix keypress event, filter mousemove.
Radek Brich <radek.brich@devl.cz>
parents:
48
diff
changeset
|
93 |
event = self.event |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
94 |
if event.type == event.MOUSEMOVE: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
95 |
return ('mousemove', event.mouse.x, event.mouse.y) |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
96 |
if event.type == event.MOUSEDOWN: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
97 |
return ('mousedown', event.mouse.x, event.mouse.y, event.mouse.button) |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
98 |
if event.type == event.MOUSEUP: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
99 |
return ('mouseup', event.mouse.x, event.mouse.y, event.mouse.button) |
55
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
100 |
if event.type == event.MOUSEWHEEL: |
1ab0edd5d784
DriverSDL: mousewheel, key repeation.
Radek Brich <radek.brich@devl.cz>
parents:
54
diff
changeset
|
101 |
return ('mousewheel', event.mouse.x, event.mouse.y, event.mouse.button) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
102 |
if event.type == event.KEYPRESS: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
103 |
keyname = event.key.keyname |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
104 |
if keyname: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
105 |
keyname = keyname.decode() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
106 |
else: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
107 |
keyname = None |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
108 |
char = event.key.unicode |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
109 |
if char == '\x00': |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
110 |
char = None |
67
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
111 |
mod = event.key.mod |
71f60bf6ebb7
DriverSDL: add support for key modifiers.
Radek Brich <radek.brich@devl.cz>
parents:
57
diff
changeset
|
112 |
return ('keypress', keyname, char, mod) |
53
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
113 |
if event.type == event.RESIZE: |
c4263588b716
DriverSDL: Implement cursor, handle window resize.
Radek Brich <radek.brich@devl.cz>
parents:
50
diff
changeset
|
114 |
return ('resize',) |
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
115 |
if event.type == event.QUIT: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
116 |
return ('quit',) |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
117 |
return ('unknown',) |
47
537d7c6b48a2
Add sdlterm prototype: extension module for SDL driver.
Radek Brich <radek.brich@devl.cz>
parents:
diff
changeset
|
118 |
|
48
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
119 |
property width: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
120 |
def __get__(self): return self.thisptr.get_width() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
121 |
property height: |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
122 |
def __get__(self): return self.thisptr.get_height() |
1f00e90fd72a
Add SDL driver prototype. Update sdlterm: Handle keyboard, mouse events. Add glyph cache.
Radek Brich <radek.brich@devl.cz>
parents:
47
diff
changeset
|
123 |