forked from speedie/spmenu
move some stuff around
This commit is contained in:
parent
29781c8084
commit
eb83b0376d
|
@ -4,6 +4,13 @@ void prepare_window_size(void) {
|
||||||
sp = menupaddingh;
|
sp = menupaddingh;
|
||||||
vp = (menuposition == 1) ? menupaddingv : - menupaddingv;
|
vp = (menuposition == 1) ? menupaddingv : - menupaddingv;
|
||||||
|
|
||||||
|
bh = MAX(drw->font->h, drw->font->h + 2 + lineheight);
|
||||||
|
lines = MAX(lines, 0);
|
||||||
|
reallines = lines;
|
||||||
|
|
||||||
|
lrpad = drw->font->h + textpadding;
|
||||||
|
mh = (lines + 1) * bh + 2 * menumarginv; // lines + 1 * bh is the menu height
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +47,16 @@ void set_window(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_prop(void) {
|
void set_prop(void) {
|
||||||
if (dockproperty) XChangeProperty(dpy, win, types, XA_ATOM, 32, PropModeReplace, (unsigned char *) &dock, 1); // set dock property
|
// set properties indicating what spmenu handles
|
||||||
return;
|
clip = XInternAtom(dpy, "CLIPBOARD", False);
|
||||||
|
utf8 = XInternAtom(dpy, "UTF8_STRING", False);
|
||||||
|
types = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||||
|
|
||||||
|
// set dock property
|
||||||
|
if (dockproperty) {
|
||||||
|
dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
||||||
|
XChangeProperty(dpy, win, types, XA_ATOM, 32, PropModeReplace, (unsigned char *) &dock, 1); // set dock property
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void resizeclient(void) {
|
void resizeclient(void) {
|
||||||
|
|
|
@ -7,7 +7,6 @@ void setupdisplay(void) {
|
||||||
unsigned int tmp, minstrlen = 0, curstrlen = 0;
|
unsigned int tmp, minstrlen = 0, curstrlen = 0;
|
||||||
int numwidthchecks = 100;
|
int numwidthchecks = 100;
|
||||||
struct item *item;
|
struct item *item;
|
||||||
XIM xim;
|
|
||||||
Window w, dw, *dws;
|
Window w, dw, *dws;
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
#if USEXINERAMA
|
#if USEXINERAMA
|
||||||
|
@ -16,16 +15,7 @@ void setupdisplay(void) {
|
||||||
int a, n, area = 0;
|
int a, n, area = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// set properties indicating what spmenu handles
|
prepare_window_size();
|
||||||
clip = XInternAtom(dpy, "CLIPBOARD", False);
|
|
||||||
utf8 = XInternAtom(dpy, "UTF8_STRING", False);
|
|
||||||
types = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
|
||||||
dock = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DOCK", False);
|
|
||||||
|
|
||||||
// resize client
|
|
||||||
bh = MAX(drw->font->h, drw->font->h + 2 + lineheight);
|
|
||||||
lines = MAX(lines, 0);
|
|
||||||
reallines = lines;
|
|
||||||
|
|
||||||
// resize client to image height if deemed necessary
|
// resize client to image height if deemed necessary
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
|
@ -125,18 +115,7 @@ void setupdisplay(void) {
|
||||||
setimageopts();
|
setimageopts();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// input methods
|
open_xim(); // open xim
|
||||||
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
|
|
||||||
XSetLocaleModifiers("@im=local");
|
|
||||||
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
|
|
||||||
XSetLocaleModifiers("@im=");
|
|
||||||
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
|
|
||||||
die("XOpenIM failed: could not open input device");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
|
||||||
XNClientWindow, win, XNFocusWindow, win, NULL);
|
|
||||||
|
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
|
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
|
static Atom clip, utf8, types, dock;
|
||||||
|
static Display *dpy;
|
||||||
|
static Window root, parentwin, win;
|
||||||
|
|
||||||
static void setupdisplay(void);
|
static void setupdisplay(void);
|
||||||
|
|
16
libs/x11/xim.c
Normal file
16
libs/x11/xim.c
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
void open_xim(void) {
|
||||||
|
XIM xim;
|
||||||
|
|
||||||
|
// input methods
|
||||||
|
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
|
||||||
|
XSetLocaleModifiers("@im=local");
|
||||||
|
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL) {
|
||||||
|
XSetLocaleModifiers("@im=");
|
||||||
|
if ((xim = XOpenIM(dpy, NULL, NULL, NULL)) == NULL)
|
||||||
|
die("XOpenIM failed: could not open input device");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xic = XCreateIC(xim, XNInputStyle, XIMPreeditNothing | XIMStatusNothing,
|
||||||
|
XNClientWindow, win, XNFocusWindow, win, NULL);
|
||||||
|
}
|
3
libs/x11/xim.h
Normal file
3
libs/x11/xim.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
static XIC xic;
|
||||||
|
|
||||||
|
static void open_xim(void);
|
8
spmenu.c
8
spmenu.c
|
@ -124,6 +124,7 @@ static int allowkeys = 1; // whether or not to interpret a keypress as an insert
|
||||||
#include "libs/schemes.h"
|
#include "libs/schemes.h"
|
||||||
#include "libs/arg.h"
|
#include "libs/arg.h"
|
||||||
#include "libs/x11/xrdb.h"
|
#include "libs/x11/xrdb.h"
|
||||||
|
#include "libs/x11/xim.h"
|
||||||
#include "libs/x11/key.h"
|
#include "libs/x11/key.h"
|
||||||
#include "libs/x11/mouse.h"
|
#include "libs/x11/mouse.h"
|
||||||
#include "libs/sort.h"
|
#include "libs/sort.h"
|
||||||
|
@ -212,12 +213,6 @@ static int ignoreglobalkeys = 0; // should be set in the config file, if 1, the
|
||||||
static int ignoreconfmouse = 0; // same for mouse
|
static int ignoreconfmouse = 0; // same for mouse
|
||||||
static int ignoreglobalmouse = 0; // same for mouse
|
static int ignoreglobalmouse = 0; // same for mouse
|
||||||
|
|
||||||
// X11 properties
|
|
||||||
static Atom clip, utf8, types, dock;
|
|
||||||
static Display *dpy;
|
|
||||||
static Window root, parentwin, win;
|
|
||||||
static XIC xic;
|
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
static int useargb = 0;
|
static int useargb = 0;
|
||||||
static Visual *visual;
|
static Visual *visual;
|
||||||
|
@ -273,6 +268,7 @@ static char *(*fstrstr)(const char *, const char *) = cistrstr;
|
||||||
#include "libs/img.c"
|
#include "libs/img.c"
|
||||||
#include "libs/rtl.h"
|
#include "libs/rtl.h"
|
||||||
#include "libs/rtl.c"
|
#include "libs/rtl.c"
|
||||||
|
#include "libs/x11/xim.c"
|
||||||
#include "libs/x11/key.c"
|
#include "libs/x11/key.c"
|
||||||
#include "libs/x11/mouse.c"
|
#include "libs/x11/mouse.c"
|
||||||
#include "libs/sort.c"
|
#include "libs/sort.c"
|
||||||
|
|
Loading…
Reference in a new issue