Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simon Zeni
wlroots
Commits
9c1b87f2
Commit
9c1b87f2
authored
Nov 11, 2018
by
Scott Anderson
Browse files
backend/x11: Move atom initilisation earlier
There isn't any real reason to delay this until the backend is started.
parent
ab2c5798
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/x11/backend.c
View file @
9c1b87f2
...
...
@@ -104,46 +104,6 @@ static bool backend_start(struct wlr_backend *backend) {
struct
wlr_x11_backend
*
x11
=
get_x11_backend_from_backend
(
backend
);
x11
->
started
=
true
;
struct
{
const
char
*
name
;
xcb_intern_atom_cookie_t
cookie
;
xcb_atom_t
*
atom
;
}
atom
[]
=
{
{
.
name
=
"WM_PROTOCOLS"
,
.
atom
=
&
x11
->
atoms
.
wm_protocols
,
},
{
.
name
=
"WM_DELETE_WINDOW"
,
.
atom
=
&
x11
->
atoms
.
wm_delete_window
,
},
{
.
name
=
"_NET_WM_NAME"
,
.
atom
=
&
x11
->
atoms
.
net_wm_name
,
},
{
.
name
=
"UTF8_STRING"
,
.
atom
=
&
x11
->
atoms
.
utf8_string
,
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
atom
)
/
sizeof
(
atom
[
0
]);
++
i
)
{
atom
[
i
].
cookie
=
xcb_intern_atom
(
x11
->
xcb
,
true
,
strlen
(
atom
[
i
].
name
),
atom
[
i
].
name
);
}
for
(
size_t
i
=
0
;
i
<
sizeof
(
atom
)
/
sizeof
(
atom
[
0
]);
++
i
)
{
xcb_intern_atom_reply_t
*
reply
=
xcb_intern_atom_reply
(
x11
->
xcb
,
atom
[
i
].
cookie
,
NULL
);
if
(
reply
)
{
*
atom
[
i
].
atom
=
reply
->
atom
;
free
(
reply
);
}
else
{
*
atom
[
i
].
atom
=
XCB_ATOM_NONE
;
}
}
// create a blank cursor
xcb_pixmap_t
pix
=
xcb_generate_id
(
x11
->
xcb
);
xcb_create_pixmap
(
x11
->
xcb
,
1
,
pix
,
x11
->
screen
->
root
,
1
,
1
);
...
...
@@ -271,6 +231,34 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
XSetEventQueueOwner
(
x11
->
xlib_conn
,
XCBOwnsEventQueue
);
struct
{
const
char
*
name
;
xcb_intern_atom_cookie_t
cookie
;
xcb_atom_t
*
atom
;
}
atom
[]
=
{
{
.
name
=
"WM_PROTOCOLS"
,
.
atom
=
&
x11
->
atoms
.
wm_protocols
},
{
.
name
=
"WM_DELETE_WINDOW"
,
.
atom
=
&
x11
->
atoms
.
wm_delete_window
},
{
.
name
=
"_NET_WM_NAME"
,
.
atom
=
&
x11
->
atoms
.
net_wm_name
},
{
.
name
=
"UTF8_STRING"
,
.
atom
=
&
x11
->
atoms
.
utf8_string
},
};
for
(
size_t
i
=
0
;
i
<
sizeof
(
atom
)
/
sizeof
(
atom
[
0
]);
++
i
)
{
atom
[
i
].
cookie
=
xcb_intern_atom
(
x11
->
xcb
,
true
,
strlen
(
atom
[
i
].
name
),
atom
[
i
].
name
);
}
for
(
size_t
i
=
0
;
i
<
sizeof
(
atom
)
/
sizeof
(
atom
[
0
]);
++
i
)
{
xcb_intern_atom_reply_t
*
reply
=
xcb_intern_atom_reply
(
x11
->
xcb
,
atom
[
i
].
cookie
,
NULL
);
if
(
reply
)
{
*
atom
[
i
].
atom
=
reply
->
atom
;
free
(
reply
);
}
else
{
*
atom
[
i
].
atom
=
XCB_ATOM_NONE
;
}
}
int
fd
=
xcb_get_file_descriptor
(
x11
->
xcb
);
struct
wl_event_loop
*
ev
=
wl_display_get_event_loop
(
display
);
uint32_t
events
=
WL_EVENT_READABLE
|
WL_EVENT_ERROR
|
WL_EVENT_HANGUP
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment