actually changed my mind for a bit

This commit is contained in:
speedie 2023-05-23 22:31:33 +02:00
parent 01388390aa
commit 96b82dc223
7 changed files with 17 additions and 30 deletions

View file

@ -7,4 +7,3 @@
#include "client.h"
#include "client.c"
#include "init.c"
#include "mod.c"

View file

@ -2,7 +2,6 @@
#include "lib.h"
#include "init.h"
#include "mod.h"
#include "xrdb.h"
#include "xim.h"
#include "key.h"

View file

@ -138,3 +138,12 @@ void setupdisplay(void) {
match();
drawmenu();
}
Display * opendisplay(char *disp) {
return XOpenDisplay(disp);
}
void set_screen(Display *disp) {
screen = DefaultScreen(disp);
root = RootWindow(disp, screen);
}

View file

@ -5,3 +5,5 @@ static Display *dpy;
static Window root, parentwin, win;
static void setupdisplay(void);
static void set_screen(Display *disp);
static Display * opendisplay(char *disp);

View file

@ -1,17 +0,0 @@
/* See LICENSE file for copyright and license details. */
int get_locale(char *modifier_list) {
if (XSetLocaleModifiers(modifier_list)) {
return 0;
} else {
return 1;
}
}
int supports_locale() {
if (XSupportsLocale()) {
return 0;
} else {
return 1;
}
}

View file

@ -1,4 +0,0 @@
/* See LICENSE file for copyright and license details. */
static int get_locale(char *modifier_list);
static int supports_locale();

View file

@ -534,26 +534,25 @@ int main(int argc, char *argv[]) {
strcpy(modetext, normtext);
}
if (!setlocale(LC_CTYPE, "") || !supports_locale())
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
fputs("warning: no locale support\n", stderr); // invalid locale, so notify the user about it
if (!get_locale("")) {
if (!XSetLocaleModifiers(""))
fputs("warning: no locale modifiers support\n", stderr);
}
if (!(dpy = XOpenDisplay(NULL)))
if (!(dpy = opendisplay(NULL)))
die("spmenu: cannot open display"); // failed to open display
// set screen and root window
screen = DefaultScreen(dpy);
root = RootWindow(dpy, screen);
set_screen(dpy);
// parent window is the root window (ie. window manager) because we're not embedding
if (!embed || !(parentwin = strtol(embed, NULL, 0)))
parentwin = root;
if (!XGetWindowAttributes(dpy, parentwin, &wa))
if (!XGetWindowAttributes(dpy, parentwin, &wa)) {
die("spmenu: could not get embedding window attributes: 0x%lx", parentwin);
}
xinitvisual(); // init visual and create drawable after
drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); // wrapper function creating a drawable