Skip to content

Commit 0557eaf

Browse files
committed
Store screen info (xcb_screen_t) in XCBWindow
1 parent 32cb0b5 commit 0557eaf

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/testing.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function event_xcb(wm::XWindowManager, e::Event)
7979
T === xcb_configure_notify_event_t && return T(response_type_xcb(e), 0, 0, e.win.id, e.win.id, 0, x, y, wx, wy, 0, 0, 0)
8080
T === xcb_focus_in_event_t && return T(response_type_xcb(e), detail_xcb(wm, e), 0, e.win.id, 0, (0, 0, 0))
8181
e.type == WINDOW_CLOSED && return T(response_type_xcb(e), 32, 0, e.win.id, 0x00000183, xcb_client_message_data_t(serialize_delete_request_data(e.win.delete_request)))
82-
T(response_type_xcb(e), detail_xcb(wm, e), 0, 0, e.win.parent_id, e.win.id, 0, 0, 0, x, y, state_xcb(e), true, false)
82+
T(response_type_xcb(e), detail_xcb(wm, e), 0, 0, e.win.screen.root, e.win.id, 0, 0, 0, x, y, state_xcb(e), true, false)
8383
end
8484

8585
send_event(wm::XWindowManager, e::Event) = send_event(e.win, event_xcb(wm, e))

src/window.jl

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,32 @@ Window type used with the XCB API.
44
mutable struct XCBWindow <: AbstractWindow
55
conn::Connection
66
id::xcb_window_t
7-
parent_id::xcb_window_t
8-
visual_id::xcb_visualid_t
7+
screen::xcb_screen_t
98
delete_request::xcb_atom_t
109
gc::Union{Nothing,GraphicsContext}
1110
end
1211

1312
"""
14-
Create a new window whose parent is given by `parent_id` and visual by `visual_id`.
13+
Create a new window on the provided `screen`.
1514
"""
16-
function XCBWindow(conn, parent_id, visual_id; depth=XCB_COPY_FROM_PARENT, x=0, y=0, width=512, height=512, border_width=1, class=XCB_WINDOW_CLASS_INPUT_OUTPUT, window_title="", icon_title=nothing, map=true, attributes=[], values=[])
15+
function XCBWindow(conn, screen::xcb_screen_t; depth=XCB_COPY_FROM_PARENT, x=0, y=0, width=512, height=512, border_width=1, class=XCB_WINDOW_CLASS_INPUT_OUTPUT, window_title="", icon_title=nothing, map=true, attributes=[], values=[])
1716
win_id = xcb_generate_id(conn)
1817
xcb_create_window(
1918
conn,
2019
depth,
2120
win_id,
22-
parent_id,
21+
screen.root,
2322
x,
2423
y,
2524
width,
2625
height,
2726
border_width,
2827
class,
29-
visual_id,
28+
screen.root_visual,
3029
0,
3130
C_NULL,
3231
)
33-
win = XCBWindow(conn, win_id, parent_id, visual_id, delete_request(conn, win_id), nothing)
32+
win = XCBWindow(conn, win_id, screen, delete_request(conn, win_id), nothing)
3433

3534
set_event_mask(win, keys(event_type_bits))
3635
set_attributes(win, attributes, values)
@@ -44,11 +43,6 @@ function XCBWindow(conn, parent_id, visual_id; depth=XCB_COPY_FROM_PARENT, x=0,
4443
Base.finalizer(x -> @check(:error, xcb_destroy_window(x.conn, x.id)), win)
4544
end
4645

47-
"""
48-
Create a new window on the provided `screen`.
49-
"""
50-
XCBWindow(conn::Connection, screen; kwargs...) = XCBWindow(conn, screen.root, screen.root_visual; kwargs...)
51-
5246
"""
5347
Create a new window on the current screen.
5448
"""

0 commit comments

Comments
 (0)