-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathxfixes.py
More file actions
84 lines (68 loc) · 2.87 KB
/
Copy pathxfixes.py
File metadata and controls
84 lines (68 loc) · 2.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Xlib.ext.xfixes -- XFIXES extension module
#
# Copyright (C) 2010-2011 Outpost Embedded, LLC
# Forest Bond <forest.bond@rapidrollout.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
A partial implementation of the XFIXES extension. Only the HideCursor and
ShowCursor requests are provided.
'''
from Xlib.protocol import rq
extname = 'XFIXES'
class QueryVersion(rq.ReplyRequest):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(0),
rq.RequestLength(),
rq.Card32('major_version'),
rq.Card32('minor_version')
)
_reply = rq.Struct(rq.ReplyCode(),
rq.Pad(1),
rq.Card16('sequence_number'),
rq.ReplyLength(),
rq.Card32('major_version'),
rq.Card32('minor_version'),
rq.Pad(16)
)
def query_version(self):
return QueryVersion(display=self.display,
opcode=self.display.get_extension_major(extname),
major_version=4,
minor_version=0)
class HideCursor(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(29),
rq.RequestLength(),
rq.Window('window')
)
def hide_cursor(self):
HideCursor(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self)
class ShowCursor(rq.Request):
_request = rq.Struct(rq.Card8('opcode'),
rq.Opcode(30),
rq.RequestLength(),
rq.Window('window')
)
def show_cursor(self):
ShowCursor(display=self.display,
opcode=self.display.get_extension_major(extname),
window=self)
def init(disp, info):
disp.extension_add_method('display', 'xfixes_query_version', query_version)
disp.extension_add_method('window', 'xfixes_hide_cursor', hide_cursor)
disp.extension_add_method('window', 'xfixes_show_cursor', show_cursor)