x11: xcb_aux_get_screen instead of two hand-rolled screen walks
win.c and xim.c each iterated the setup's roots to find the screen xcb_connect had chosen; xcb-util, already linked through imdkit, has xcb_aux_get_screen for that.
This commit is contained in:
15
xim.c
15
xim.c
@@ -5,6 +5,7 @@
|
||||
#include <locale.h>
|
||||
#include <poll.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_aux.h>
|
||||
#include <xcb/xkb.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include <xkbcommon/xkbcommon-compose.h>
|
||||
@@ -132,18 +133,6 @@ kwatch(void)
|
||||
events, parts, parts, nil);
|
||||
}
|
||||
|
||||
static xcb_screen_t*
|
||||
getscreen(int scr)
|
||||
{
|
||||
xcb_screen_iterator_t iter;
|
||||
|
||||
iter = xcb_setup_roots_iterator(xcb_get_setup(conn));
|
||||
for(; iter.rem; scr--, xcb_screen_next(&iter))
|
||||
if(scr == 0)
|
||||
return iter.data;
|
||||
return nil;
|
||||
}
|
||||
|
||||
static int
|
||||
translate(xcb_window_t win, int x, int y, Caret *caret)
|
||||
{
|
||||
@@ -550,7 +539,7 @@ ximinit(void)
|
||||
ximlog("cannot connect to X server");
|
||||
return -1;
|
||||
}
|
||||
screen = getscreen(scr);
|
||||
screen = xcb_aux_get_screen(conn, scr);
|
||||
if(screen == nil){
|
||||
ximlog("cannot find X screen");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user