mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
cvsimport
This commit is contained in:
commit
a957ed7c7d
44
client.c
44
client.c
@ -37,8 +37,7 @@ static void client_mtf(struct client_ctx *);
|
|||||||
static void client_none(struct screen_ctx *);
|
static void client_none(struct screen_ctx *);
|
||||||
static void client_placecalc(struct client_ctx *);
|
static void client_placecalc(struct client_ctx *);
|
||||||
static void client_update(struct client_ctx *);
|
static void client_update(struct client_ctx *);
|
||||||
static void client_gethints(struct client_ctx *);
|
static void client_getmwmhints(struct client_ctx *);
|
||||||
static void client_freehints(struct client_ctx *);
|
|
||||||
static int client_inbound(struct client_ctx *, int, int);
|
static int client_inbound(struct client_ctx *, int, int);
|
||||||
|
|
||||||
struct client_ctx *_curcc = NULL;
|
struct client_ctx *_curcc = NULL;
|
||||||
@ -59,6 +58,7 @@ struct client_ctx *
|
|||||||
client_new(Window win, struct screen_ctx *sc, int mapped)
|
client_new(Window win, struct screen_ctx *sc, int mapped)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
XClassHint xch;
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
XWMHints *wmhints;
|
XWMHints *wmhints;
|
||||||
int state;
|
int state;
|
||||||
@ -82,6 +82,12 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
conf_client(cc);
|
conf_client(cc);
|
||||||
|
|
||||||
|
if (XGetClassHint(X_Dpy, cc->win, &xch)) {
|
||||||
|
cc->app_name = xch.res_name;
|
||||||
|
cc->app_class = xch.res_class;
|
||||||
|
}
|
||||||
|
client_getmwmhints(cc);
|
||||||
|
|
||||||
/* Saved pointer position */
|
/* Saved pointer position */
|
||||||
cc->ptr.x = -1;
|
cc->ptr.x = -1;
|
||||||
cc->ptr.y = -1;
|
cc->ptr.y = -1;
|
||||||
@ -121,20 +127,19 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
||||||
xu_setstate(cc, cc->state);
|
xu_setstate(cc, cc->state);
|
||||||
|
|
||||||
XSync(X_Dpy, False);
|
|
||||||
XUngrabServer(X_Dpy);
|
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
||||||
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
||||||
|
|
||||||
xu_ewmh_net_client_list(sc);
|
xu_ewmh_net_client_list(sc);
|
||||||
|
|
||||||
client_gethints(cc);
|
|
||||||
client_update(cc);
|
client_update(cc);
|
||||||
|
|
||||||
if (mapped)
|
if (mapped)
|
||||||
group_autogroup(cc);
|
group_autogroup(cc);
|
||||||
|
|
||||||
|
XSync(X_Dpy, False);
|
||||||
|
XUngrabServer(X_Dpy);
|
||||||
|
|
||||||
return (cc);
|
return (cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +167,10 @@ client_delete(struct client_ctx *cc)
|
|||||||
client_none(sc);
|
client_none(sc);
|
||||||
|
|
||||||
XFree(cc->size);
|
XFree(cc->size);
|
||||||
|
if (cc->app_name != NULL)
|
||||||
|
XFree(cc->app_name);
|
||||||
|
if (cc->app_class != NULL)
|
||||||
|
XFree(cc->app_class);
|
||||||
|
|
||||||
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
|
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
|
||||||
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
TAILQ_REMOVE(&cc->nameq, wn, entry);
|
||||||
@ -169,7 +178,6 @@ client_delete(struct client_ctx *cc)
|
|||||||
free(wn);
|
free(wn);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_freehints(cc);
|
|
||||||
free(cc);
|
free(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -789,19 +797,12 @@ client_applysizehints(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
client_gethints(struct client_ctx *cc)
|
client_getmwmhints(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
XClassHint xch;
|
|
||||||
struct mwm_hints *mwmh;
|
struct mwm_hints *mwmh;
|
||||||
|
|
||||||
if (XGetClassHint(X_Dpy, cc->win, &xch)) {
|
if (xu_getprop(cc->win,
|
||||||
if (xch.res_name != NULL)
|
cwmh[_MOTIF_WM_HINTS].atom, cwmh[_MOTIF_WM_HINTS].atom,
|
||||||
cc->app_name = xch.res_name;
|
|
||||||
if (xch.res_class != NULL)
|
|
||||||
cc->app_class = xch.res_class;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (xu_getprop(cc->win, cwmh[_MOTIF_WM_HINTS].atom, _MOTIF_WM_HINTS,
|
|
||||||
PROP_MWM_HINTS_ELEMENTS, (u_char **)&mwmh) == MWM_NUMHINTS)
|
PROP_MWM_HINTS_ELEMENTS, (u_char **)&mwmh) == MWM_NUMHINTS)
|
||||||
if (mwmh->flags & MWM_HINTS_DECORATIONS &&
|
if (mwmh->flags & MWM_HINTS_DECORATIONS &&
|
||||||
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
!(mwmh->decorations & MWM_DECOR_ALL) &&
|
||||||
@ -809,15 +810,6 @@ client_gethints(struct client_ctx *cc)
|
|||||||
cc->bwidth = 0;
|
cc->bwidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
client_freehints(struct client_ctx *cc)
|
|
||||||
{
|
|
||||||
if (cc->app_name != NULL)
|
|
||||||
XFree(cc->app_name);
|
|
||||||
if (cc->app_class != NULL)
|
|
||||||
XFree(cc->app_class);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
client_transient(struct client_ctx *cc)
|
client_transient(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
|
13
search.c
13
search.c
@ -33,8 +33,11 @@
|
|||||||
|
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
#define PATH_EXEC 0x1
|
#define PATH_ANY 0x0001
|
||||||
|
#define PATH_EXEC 0x0002
|
||||||
|
|
||||||
|
static void search_match_path(struct menu_q *, struct menu_q *,
|
||||||
|
char *, int);
|
||||||
static int strsubmatch(char *, char *, int);
|
static int strsubmatch(char *, char *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -198,7 +201,7 @@ search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *searc
|
|||||||
void
|
void
|
||||||
search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
return (search_match_path(menuq, resultq, search, 0));
|
return (search_match_path(menuq, resultq, search, PATH_ANY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -217,6 +220,7 @@ void
|
|||||||
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
struct menu *mi, *mj;
|
struct menu *mi, *mj;
|
||||||
|
int r;
|
||||||
|
|
||||||
TAILQ_INIT(resultq);
|
TAILQ_INIT(resultq);
|
||||||
|
|
||||||
@ -225,11 +229,12 @@ search_match_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
|||||||
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
|
fnmatch(search, mi->text, 0) == FNM_NOMATCH)
|
||||||
continue;
|
continue;
|
||||||
TAILQ_FOREACH(mj, resultq, resultentry) {
|
TAILQ_FOREACH(mj, resultq, resultentry) {
|
||||||
if (strcasecmp(mi->text, mj->text) < 0) {
|
r = strcasecmp(mi->text, mj->text);
|
||||||
|
if (r < 0)
|
||||||
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
|
TAILQ_INSERT_BEFORE(mj, mi, resultentry);
|
||||||
|
if (r <= 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (mj == NULL)
|
if (mj == NULL)
|
||||||
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
TAILQ_INSERT_TAIL(resultq, mi, resultentry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user