actually changed my mind for a bit
This commit is contained in:
parent
01388390aa
commit
96b82dc223
|
@ -7,4 +7,3 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "client.c"
|
#include "client.c"
|
||||||
#include "init.c"
|
#include "init.c"
|
||||||
#include "mod.c"
|
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
#include "lib.h"
|
#include "lib.h"
|
||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "mod.h"
|
|
||||||
#include "xrdb.h"
|
#include "xrdb.h"
|
||||||
#include "xim.h"
|
#include "xim.h"
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
|
|
|
@ -138,3 +138,12 @@ void setupdisplay(void) {
|
||||||
match();
|
match();
|
||||||
drawmenu();
|
drawmenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Display * opendisplay(char *disp) {
|
||||||
|
return XOpenDisplay(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_screen(Display *disp) {
|
||||||
|
screen = DefaultScreen(disp);
|
||||||
|
root = RootWindow(disp, screen);
|
||||||
|
}
|
||||||
|
|
|
@ -5,3 +5,5 @@ static Display *dpy;
|
||||||
static Window root, parentwin, win;
|
static Window root, parentwin, win;
|
||||||
|
|
||||||
static void setupdisplay(void);
|
static void setupdisplay(void);
|
||||||
|
static void set_screen(Display *disp);
|
||||||
|
static Display * opendisplay(char *disp);
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
|
||||||
|
|
||||||
static int get_locale(char *modifier_list);
|
|
||||||
static int supports_locale();
|
|
13
spmenu.c
13
spmenu.c
|
@ -534,26 +534,25 @@ int main(int argc, char *argv[]) {
|
||||||
strcpy(modetext, normtext);
|
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
|
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);
|
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
|
die("spmenu: cannot open display"); // failed to open display
|
||||||
|
|
||||||
// set screen and root window
|
// set screen and root window
|
||||||
screen = DefaultScreen(dpy);
|
set_screen(dpy);
|
||||||
root = RootWindow(dpy, screen);
|
|
||||||
|
|
||||||
// parent window is the root window (ie. window manager) because we're not embedding
|
// parent window is the root window (ie. window manager) because we're not embedding
|
||||||
if (!embed || !(parentwin = strtol(embed, NULL, 0)))
|
if (!embed || !(parentwin = strtol(embed, NULL, 0)))
|
||||||
parentwin = root;
|
parentwin = root;
|
||||||
|
|
||||||
if (!XGetWindowAttributes(dpy, parentwin, &wa))
|
if (!XGetWindowAttributes(dpy, parentwin, &wa)) {
|
||||||
die("spmenu: could not get embedding window attributes: 0x%lx", parentwin);
|
die("spmenu: could not get embedding window attributes: 0x%lx", parentwin);
|
||||||
|
}
|
||||||
|
|
||||||
xinitvisual(); // init visual and create drawable after
|
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
|
drw = drw_create(dpy, screen, root, wa.width, wa.height, visual, depth, cmap); // wrapper function creating a drawable
|
||||||
|
|
Loading…
Reference in a new issue