Skip to content

Commit f7d83a5

Browse files
authored
Fix temporary names left over from x11rb migration (#179)
1 parent ea0cd53 commit f7d83a5

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

src/x11/window.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -188,13 +188,13 @@ impl<'a> Window<'a> {
188188
let xcb_connection = XcbConnection::new()?;
189189

190190
// Get screen information (?)
191-
let setup = xcb_connection.conn2.setup();
191+
let setup = xcb_connection.conn.setup();
192192
let screen = &setup.roots[xcb_connection.screen];
193193

194194
let parent_id = parent.unwrap_or_else(|| screen.root);
195195

196-
let gc_id = xcb_connection.conn2.generate_id()?;
197-
xcb_connection.conn2.create_gc(
196+
let gc_id = xcb_connection.conn.generate_id()?;
197+
xcb_connection.conn.create_gc(
198198
gc_id,
199199
parent_id,
200200
&CreateGCAux::new().foreground(screen.black_pixel).graphics_exposures(0),
@@ -234,11 +234,11 @@ impl<'a> Window<'a> {
234234

235235
// For this 32-bith depth to work, you also need to define a color map and set a border
236236
// pixel: https://cgit.freedesktop.org/xorg/xserver/tree/dix/window.c#n818
237-
let colormap = xcb_connection.conn2.generate_id()?;
238-
xcb_connection.conn2.create_colormap(ColormapAlloc::NONE, colormap, screen.root, visual)?;
237+
let colormap = xcb_connection.conn.generate_id()?;
238+
xcb_connection.conn.create_colormap(ColormapAlloc::NONE, colormap, screen.root, visual)?;
239239

240-
let window_id = xcb_connection.conn2.generate_id()?;
241-
xcb_connection.conn2.create_window(
240+
let window_id = xcb_connection.conn.generate_id()?;
241+
xcb_connection.conn.create_window(
242242
depth,
243243
window_id,
244244
parent_id,
@@ -266,27 +266,27 @@ impl<'a> Window<'a> {
266266
.colormap(colormap)
267267
.border_pixel(0),
268268
)?;
269-
xcb_connection.conn2.map_window(window_id)?;
269+
xcb_connection.conn.map_window(window_id)?;
270270

271271
// Change window title
272272
let title = options.title;
273-
xcb_connection.conn2.change_property8(
273+
xcb_connection.conn.change_property8(
274274
PropMode::REPLACE,
275275
window_id,
276276
AtomEnum::WM_NAME,
277277
AtomEnum::STRING,
278278
title.as_bytes(),
279279
)?;
280280

281-
xcb_connection.conn2.change_property32(
281+
xcb_connection.conn.change_property32(
282282
PropMode::REPLACE,
283283
window_id,
284-
xcb_connection.atoms2.WM_PROTOCOLS,
284+
xcb_connection.atoms.WM_PROTOCOLS,
285285
AtomEnum::ATOM,
286-
&[xcb_connection.atoms2.WM_DELETE_WINDOW],
286+
&[xcb_connection.atoms.WM_DELETE_WINDOW],
287287
)?;
288288

289-
xcb_connection.conn2.flush()?;
289+
xcb_connection.conn.flush()?;
290290

291291
// TODO: These APIs could use a couple tweaks now that everything is internal and there is
292292
// no error handling anymore at this point. Everything is more or less unchanged
@@ -345,11 +345,11 @@ impl<'a> Window<'a> {
345345
let xid = self.inner.xcb_connection.get_cursor(mouse_cursor).unwrap();
346346

347347
if xid != 0 {
348-
let _ = self.inner.xcb_connection.conn2.change_window_attributes(
348+
let _ = self.inner.xcb_connection.conn.change_window_attributes(
349349
self.inner.window_id,
350350
&ChangeWindowAttributesAux::new().cursor(xid),
351351
);
352-
let _ = self.inner.xcb_connection.conn2.flush();
352+
let _ = self.inner.xcb_connection.conn.flush();
353353
}
354354

355355
self.inner.mouse_cursor = mouse_cursor;
@@ -371,13 +371,13 @@ impl<'a> Window<'a> {
371371
let scaling = self.inner.window_info.scale();
372372
let new_window_info = WindowInfo::from_logical_size(size, scaling);
373373

374-
let _ = self.inner.xcb_connection.conn2.configure_window(
374+
let _ = self.inner.xcb_connection.conn.configure_window(
375375
self.inner.window_id,
376376
&ConfigureWindowAux::new()
377377
.width(new_window_info.physical_size().width)
378378
.height(new_window_info.physical_size().height),
379379
);
380-
let _ = self.inner.xcb_connection.conn2.flush();
380+
let _ = self.inner.xcb_connection.conn.flush();
381381

382382
// This will trigger a `ConfigureNotify` event which will in turn change `self.window_info`
383383
// and notify the window handler about it
@@ -413,7 +413,7 @@ impl WindowInner {
413413
// when they've all been coalesced.
414414
self.new_physical_size = None;
415415

416-
while let Some(event) = self.xcb_connection.conn2.poll_for_event()? {
416+
while let Some(event) = self.xcb_connection.conn.poll_for_event()? {
417417
self.handle_xcb_event(handler, event);
418418
}
419419

@@ -438,7 +438,7 @@ impl WindowInner {
438438
fn run_event_loop(&mut self, handler: &mut dyn WindowHandler) -> Result<(), Box<dyn Error>> {
439439
use nix::poll::*;
440440

441-
let xcb_fd = self.xcb_connection.conn2.as_raw_fd();
441+
let xcb_fd = self.xcb_connection.conn.as_raw_fd();
442442

443443
let mut last_frame = Instant::now();
444444
self.event_loop_running = true;
@@ -545,7 +545,7 @@ impl WindowInner {
545545
////
546546
XEvent::ClientMessage(event) => {
547547
if event.format == 32
548-
&& event.data.as_data32()[0] == self.xcb_connection.atoms2.WM_DELETE_WINDOW
548+
&& event.data.as_data32()[0] == self.xcb_connection.atoms.WM_DELETE_WINDOW
549549
{
550550
self.handle_close_requested(handler);
551551
}

src/x11/xcb_connection.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::MouseCursor;
1414
use super::cursor;
1515

1616
x11rb::atom_manager! {
17-
pub Atoms2: AtomsCookie {
17+
pub Atoms: AtomsCookie {
1818
WM_PROTOCOLS,
1919
WM_DELETE_WINDOW,
2020
}
@@ -25,9 +25,9 @@ x11rb::atom_manager! {
2525
/// Keeps track of the xcb connection itself and the xlib display ID that was used to connect.
2626
pub struct XcbConnection {
2727
pub(crate) dpy: *mut Display,
28-
pub(crate) conn2: XCBConnection,
28+
pub(crate) conn: XCBConnection,
2929
pub(crate) screen: usize,
30-
pub(crate) atoms2: Atoms2,
30+
pub(crate) atoms: Atoms,
3131
pub(crate) resources: resource_manager::Database,
3232
pub(crate) cursor_handle: CursorHandle,
3333
pub(super) cursor_cache: HashMap<MouseCursor, u32>,
@@ -40,20 +40,20 @@ impl XcbConnection {
4040
let xcb_connection = unsafe { xlib_xcb::XGetXCBConnection(dpy) };
4141
assert!(!xcb_connection.is_null());
4242
let screen = unsafe { xlib::XDefaultScreen(dpy) } as usize;
43-
let conn2 = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, true)? };
43+
let conn = unsafe { XCBConnection::from_raw_xcb_connection(xcb_connection, true)? };
4444
unsafe {
4545
xlib_xcb::XSetEventQueueOwner(dpy, xlib_xcb::XEventQueueOwner::XCBOwnsEventQueue)
4646
};
4747

48-
let atoms2 = Atoms2::new(&conn2)?.reply()?;
49-
let resources = resource_manager::new_from_default(&conn2)?;
50-
let cursor_handle = CursorHandle::new(&conn2, screen, &resources)?.reply()?;
48+
let atoms = Atoms::new(&conn)?.reply()?;
49+
let resources = resource_manager::new_from_default(&conn)?;
50+
let cursor_handle = CursorHandle::new(&conn, screen, &resources)?.reply()?;
5151

5252
Ok(Self {
5353
dpy,
54-
conn2,
54+
conn,
5555
screen,
56-
atoms2,
56+
atoms,
5757
resources,
5858
cursor_handle,
5959
cursor_cache: HashMap::new(),
@@ -76,7 +76,7 @@ impl XcbConnection {
7676
// If neither work, I guess just assume 96.0 and don't do any scaling.
7777
fn get_scaling_screen_dimensions(&self) -> f64 {
7878
// Figure out screen information
79-
let setup = self.conn2.setup();
79+
let setup = self.conn.setup();
8080
let screen = &setup.roots[self.screen];
8181

8282
// Get the DPI from the screen struct
@@ -109,7 +109,7 @@ impl XcbConnection {
109109
Entry::Occupied(entry) => Ok(*entry.get()),
110110
Entry::Vacant(entry) => {
111111
let cursor =
112-
cursor::get_xcursor(&self.conn2, self.screen, &self.cursor_handle, cursor)?;
112+
cursor::get_xcursor(&self.conn, self.screen, &self.cursor_handle, cursor)?;
113113
entry.insert(cursor);
114114
Ok(cursor)
115115
}

0 commit comments

Comments
 (0)