migrate to xemil
This commit is contained in:
parent
9954655fef
commit
992a035e4e
6 changed files with 277 additions and 136 deletions
|
|
@ -3,14 +3,13 @@ include(MDEPkgConfig)
|
||||||
mde_setup_project(milkwm ${CMAKE_INSTALL_BINDIR})
|
mde_setup_project(milkwm ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
||||||
mde_pkg_config_add(milkwm x11)
|
mde_pkg_config_add(milkwm x11)
|
||||||
mde_pkg_config_add(milkwm libconfig)
|
|
||||||
|
|
||||||
mde_math_add(milkwm)
|
mde_math_add(milkwm)
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
milkwm
|
milkwm
|
||||||
PRIVATE
|
PRIVATE
|
||||||
pthread
|
xemil pthread
|
||||||
)
|
)
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,21 @@
|
||||||
|
|
||||||
/* we prefix them for reasons */
|
/* we prefix them for reasons */
|
||||||
|
|
||||||
config_t wm_config;
|
xemil_t* wm_config = NULL;
|
||||||
|
|
||||||
void wm_config_init(void) {
|
void wm_config_init(void) {
|
||||||
config_init(&wm_config);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void read_config(const char* path) {
|
static void read_config(const char* path) {
|
||||||
if(!config_read_file(&wm_config, path)) {
|
xemil_t* tmp;
|
||||||
fprintf(stderr, "MilkWM config error: file %s at line %d: %s\n", path, config_error_line(&wm_config), config_error_text(&wm_config));
|
|
||||||
|
if((tmp = xl_open_file(path)) == NULL || !xl_parse(tmp)) {
|
||||||
|
fprintf(stderr, "MPanel config error: file %s\n", path);
|
||||||
|
if(tmp != NULL) xl_close(tmp);
|
||||||
|
} else {
|
||||||
|
if(wm_config != NULL) xl_close(wm_config);
|
||||||
|
|
||||||
|
wm_config = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,7 +28,6 @@ void wm_config_read(void) {
|
||||||
free(dir);
|
free(dir);
|
||||||
free(conf);
|
free(conf);
|
||||||
|
|
||||||
config_clear(&wm_config);
|
|
||||||
read_config(SYSCONFDIR "/milkwm/milkwmrc");
|
read_config(SYSCONFDIR "/milkwm/milkwmrc");
|
||||||
read_config(path);
|
read_config(path);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
/* External */
|
/* External */
|
||||||
#include <libconfig.h>
|
#include <xemil.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
@ -51,7 +51,7 @@ int wm_content_x(void);
|
||||||
int wm_content_y(void);
|
int wm_content_y(void);
|
||||||
|
|
||||||
/* config.c */
|
/* config.c */
|
||||||
extern config_t wm_config;
|
extern xemil_t* wm_config;
|
||||||
|
|
||||||
void wm_config_init(void);
|
void wm_config_init(void);
|
||||||
void wm_config_read(void);
|
void wm_config_read(void);
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,38 @@
|
||||||
# This file should be copied to .config/milkwm/milkwmrc
|
<?xml version="1.0"?>
|
||||||
|
<!-- This file should be copied to .config/milkwm/milkwmrc -->
|
||||||
|
<MilkWM>
|
||||||
|
<Wallpaper Type="Fill">@CMAKE_INSTALL_FULL_DATAROOTDIR@/wallpapers/mde/blue.png</Wallpaper>
|
||||||
|
<Window>
|
||||||
|
<TitleBar>
|
||||||
|
<Button>
|
||||||
|
<Left>
|
||||||
|
<!-- Ordered from left to right -->
|
||||||
|
<Close />
|
||||||
|
</Left>
|
||||||
|
<Right>
|
||||||
|
<!-- Ordered from right to left -->
|
||||||
|
<Maximize />
|
||||||
|
<Iconify />
|
||||||
|
</Right>
|
||||||
|
</Button>
|
||||||
|
</TitleBar>
|
||||||
|
<!-- Just don't write anything if you want default background/foreground -->
|
||||||
|
<Background>
|
||||||
|
<Active>
|
||||||
|
<Gradient From="#435f7e" To="#0a284b" />
|
||||||
|
</Active>
|
||||||
|
<Inactive>
|
||||||
|
<Gradient From="#a0a0a0" To="#cdcdcd" />
|
||||||
|
</Inactive>
|
||||||
|
</Background>
|
||||||
|
<Foreground>
|
||||||
|
<Active>white</Active>
|
||||||
|
</Foreground>
|
||||||
|
|
||||||
Wallpaper: {
|
<!--
|
||||||
Type = "Fill";
|
Left, Right, or Center
|
||||||
Path = "@CMAKE_INSTALL_FULL_DATAROOTDIR@/wallpapers/mde/blue.png";
|
Default is Center
|
||||||
};
|
-->
|
||||||
|
<Align>Left</Align>
|
||||||
Window: {
|
</Window>
|
||||||
TitleBar: {
|
</MilkWM>
|
||||||
Buttons: {
|
|
||||||
# Ordered from left to right
|
|
||||||
Left = [
|
|
||||||
"Close"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Ordered from right to left
|
|
||||||
Right = [
|
|
||||||
"Maximize",
|
|
||||||
"Iconify"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
Active: {
|
|
||||||
Background: {
|
|
||||||
From = "#435f7e";
|
|
||||||
To = "#0a284b";
|
|
||||||
};
|
|
||||||
Foreground = "white";
|
|
||||||
};
|
|
||||||
Inactive: {
|
|
||||||
# Just don't write anything if you want default background/foreground
|
|
||||||
Background: {
|
|
||||||
From = "#a0a0a0";
|
|
||||||
To = "#cdcdcd";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Left, Right, or Center
|
|
||||||
# Default is Center
|
|
||||||
Align = "Left";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
|
||||||
241
milkwm/wm.c
241
milkwm/wm.c
|
|
@ -116,10 +116,24 @@ static int alignment(const char* str) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void apply_config(MwWidget wnd) {
|
static void apply_config(MwWidget wnd) {
|
||||||
wmframe_t* f = wnd->opaque;
|
wmframe_t* f = wnd->opaque;
|
||||||
const char* str;
|
const char* str = NULL;
|
||||||
|
xl_node_t* n = wm_config->root->first_child;
|
||||||
|
|
||||||
if(config_lookup_string(&wm_config, "Window.TitleBar.Align", &str)) {
|
while(n != NULL) {
|
||||||
|
if(n->type == XL_NODE_NODE && strcmp(n->name, "Window") == 0) {
|
||||||
|
xl_node_t* n2 = n->first_child;
|
||||||
|
while(n2 != NULL) {
|
||||||
|
if(n2->type == XL_NODE_NODE && strcmp(n2->name, "Align") == 0 && n2->text != NULL) {
|
||||||
|
str = n2->text;
|
||||||
|
}
|
||||||
|
n2 = n2->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(str != NULL) {
|
||||||
MwVaApply(f->title,
|
MwVaApply(f->title,
|
||||||
MwNalignment, alignment(str),
|
MwNalignment, alignment(str),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
@ -249,14 +263,49 @@ static void drag(MwWidget handle, void* user, void* client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static xl_node_t* get_window(void) {
|
||||||
|
xl_node_t* n;
|
||||||
|
|
||||||
|
if(wm_config == NULL || wm_config->root == NULL) return NULL;
|
||||||
|
|
||||||
|
n = wm_config->root->first_child;
|
||||||
|
while(n != NULL) {
|
||||||
|
if(n->type == XL_NODE_NODE && strcmp(n->name, "Window") == 0) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static xl_node_t* get_titlebar(void) {
|
||||||
|
xl_node_t* n;
|
||||||
|
|
||||||
|
if(wm_config == NULL || wm_config->root == NULL) return NULL;
|
||||||
|
|
||||||
|
n = get_window();
|
||||||
|
if(n == NULL) return NULL;
|
||||||
|
|
||||||
|
n = n->first_child;
|
||||||
|
while(n != NULL) {
|
||||||
|
if(n->type == XL_NODE_NODE && strcmp(n->name, "TitleBar") == 0) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
MwWidget wm_frame(int w, int h) {
|
MwWidget wm_frame(int w, int h) {
|
||||||
MwWidget wnd, titlebar;
|
MwWidget wnd, titlebar;
|
||||||
int i;
|
int i;
|
||||||
config_setting_t* s;
|
wmframe_t* f = malloc(sizeof(*f));
|
||||||
const char* str;
|
unsigned char* icon;
|
||||||
wmframe_t* f = malloc(sizeof(*f));
|
int y, x;
|
||||||
unsigned char* icon;
|
|
||||||
int y, x;
|
|
||||||
|
|
||||||
pthread_mutex_lock(&xmutex);
|
pthread_mutex_lock(&xmutex);
|
||||||
|
|
||||||
|
|
@ -319,26 +368,44 @@ MwWidget wm_frame(int w, int h) {
|
||||||
MwAddUserHandler(f->title, MwNmouseMoveHandler, drag, NULL);
|
MwAddUserHandler(f->title, MwNmouseMoveHandler, drag, NULL);
|
||||||
MwAddUserHandler(f->title, MwNmouseDownHandler, drag_down, NULL);
|
MwAddUserHandler(f->title, MwNmouseDownHandler, drag_down, NULL);
|
||||||
|
|
||||||
s = config_lookup(&wm_config, "Window.TitleBar.Buttons.Left");
|
for(i = 0; i < 2; i++) {
|
||||||
for(i = 0; (str = config_setting_get_string_elem(s, i)) != NULL; i++) {
|
xl_node_t* node = get_titlebar();
|
||||||
MwWidget w = MwVaCreateWidget(MwButtonClass, "button", f->titlebar, 0, 0, TitleBarHeight, TitleBarHeight,
|
xl_node_t* n;
|
||||||
MwNborderWidth, 1,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
apply_button(w, str);
|
if(node == NULL) continue;
|
||||||
|
|
||||||
arrput(f->left, w);
|
n = node->first_child;
|
||||||
}
|
while(n != NULL) {
|
||||||
|
if(n->type == XL_NODE_NODE && strcmp(n->name, "Button") == 0) {
|
||||||
|
xl_node_t* n2 = n->first_child;
|
||||||
|
while(n2 != NULL) {
|
||||||
|
if(n2->type == XL_NODE_NODE && strcmp(n2->name, i == 0 ? "Left" : "Right") == 0) {
|
||||||
|
xl_node_t* n3 = n2->first_child;
|
||||||
|
while(n3 != NULL) {
|
||||||
|
if(n3->type == XL_NODE_NODE) {
|
||||||
|
MwWidget w = MwVaCreateWidget(MwButtonClass, "button", f->titlebar, 0, 0, TitleBarHeight, TitleBarHeight,
|
||||||
|
MwNborderWidth, 1,
|
||||||
|
NULL);
|
||||||
|
|
||||||
s = config_lookup(&wm_config, "Window.TitleBar.Buttons.Right");
|
apply_button(w, n3->name);
|
||||||
for(i = 0; (str = config_setting_get_string_elem(s, i)) != NULL; i++) {
|
|
||||||
MwWidget w = MwVaCreateWidget(MwButtonClass, "button", f->titlebar, 0, 0, TitleBarHeight, TitleBarHeight,
|
|
||||||
MwNborderWidth, 1,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
apply_button(w, str);
|
if(i == 0) {
|
||||||
|
arrput(f->left, w);
|
||||||
|
} else {
|
||||||
|
arrput(f->right, w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
arrput(f->right, w);
|
n3 = n3->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n2 = n2->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_config(wnd);
|
apply_config(wnd);
|
||||||
|
|
@ -377,51 +444,90 @@ void wm_set_name(MwWidget widget, const char* name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static char tmp_bg[64];
|
static char tmp_bg[64];
|
||||||
MwLLPixmap lookup_bg(MwWidget widget, const char* path, const char** bg) {
|
|
||||||
config_setting_t* s = config_lookup(&wm_config, path);
|
|
||||||
wmframe_t* f = widget->opaque;
|
|
||||||
MwLLPixmap px = NULL;
|
|
||||||
|
|
||||||
*bg = NULL;
|
MwLLPixmap lookup_col(MwWidget widget, const char* bgfg, const char* type, const char** bg) {
|
||||||
if(s == NULL) {
|
wmframe_t* f = widget->opaque;
|
||||||
} else if(config_setting_type(s) == CONFIG_TYPE_STRING) {
|
MwLLPixmap px = NULL;
|
||||||
*bg = config_setting_get_string(s);
|
xl_node_t* node = get_window();
|
||||||
} else if(config_setting_type(s) == CONFIG_TYPE_GROUP) {
|
xl_node_t* n;
|
||||||
const char* from;
|
|
||||||
const char* to;
|
|
||||||
int i;
|
|
||||||
unsigned char* d = malloc(1 * TitleBarHeight * 4);
|
|
||||||
MwLLColor cfrom;
|
|
||||||
MwLLColor cto;
|
|
||||||
int fr, fg, fb;
|
|
||||||
int tr, tg, tb;
|
|
||||||
|
|
||||||
config_setting_lookup_string(s, "From", &from);
|
*bg = NULL;
|
||||||
config_setting_lookup_string(s, "To", &to);
|
|
||||||
|
|
||||||
cfrom = MwParseColor(widget, from == NULL ? MwGetText(widget, MwNbackground) : from);
|
if(node == NULL) return NULL;
|
||||||
cto = MwParseColor(widget, to == NULL ? MwGetText(widget, MwNbackground) : to);
|
|
||||||
MwColorGet(cfrom, &fr, &fg, &fb);
|
|
||||||
MwColorGet(cto, &tr, &tg, &tb);
|
|
||||||
MwLLFreeColor(cfrom);
|
|
||||||
MwLLFreeColor(cto);
|
|
||||||
|
|
||||||
memset(d, 255, 1 * TitleBarHeight * 4);
|
n = node->first_child;
|
||||||
|
|
||||||
for(i = 0; i < TitleBarHeight; i++) {
|
while(n != NULL) {
|
||||||
d[i * 4 + 0] = fr + (tr - fr) * i / TitleBarHeight;
|
if(n->type == XL_NODE_NODE && strcmp(n->name, bgfg) == 0) {
|
||||||
d[i * 4 + 1] = fg + (tg - fg) * i / TitleBarHeight;
|
xl_node_t* n2 = n->first_child;
|
||||||
d[i * 4 + 2] = fb + (tb - fb) * i / TitleBarHeight;
|
while(n2 != NULL) {
|
||||||
}
|
if(n2->type == XL_NODE_NODE && strcmp(n2->name, type) == 0) {
|
||||||
px = MwLoadRaw(widget, d, 1, TitleBarHeight);
|
if(n2->text != NULL) {
|
||||||
|
*bg = n2->text;
|
||||||
|
} else {
|
||||||
|
const char* from = NULL;
|
||||||
|
const char* to;
|
||||||
|
int i;
|
||||||
|
unsigned char* d = malloc(1 * TitleBarHeight * 4);
|
||||||
|
MwLLColor cfrom;
|
||||||
|
MwLLColor cto;
|
||||||
|
int fr, fg, fb;
|
||||||
|
int tr, tg, tb;
|
||||||
|
xl_node_t* n3 = n2->first_child;
|
||||||
|
|
||||||
sprintf(tmp_bg, "#%02x%02x%02x", fr + (tr - fr) / 2, fg + (tg - fg) / 2, fb + (tb - fb) / 2);
|
while(n3 != NULL) {
|
||||||
*bg = &tmp_bg[0];
|
if(n3->type == XL_NODE_NODE && strcmp(n3->name, "Gradient") == 0) {
|
||||||
|
xl_attribute_t* a = n3->first_attribute;
|
||||||
|
|
||||||
free(d);
|
while(a != NULL) {
|
||||||
}
|
if(strcmp(a->key, "From") == 0) {
|
||||||
|
from = a->value;
|
||||||
|
} else if(strcmp(a->key, "To") == 0) {
|
||||||
|
to = a->value;
|
||||||
|
}
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n3 = n3->next;
|
||||||
|
}
|
||||||
|
|
||||||
return px;
|
if(from == NULL || to == NULL) {
|
||||||
|
free(d);
|
||||||
|
|
||||||
|
n2 = n2->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfrom = MwParseColor(widget, from == NULL ? MwGetText(widget, MwNbackground) : from);
|
||||||
|
cto = MwParseColor(widget, to == NULL ? MwGetText(widget, MwNbackground) : to);
|
||||||
|
MwColorGet(cfrom, &fr, &fg, &fb);
|
||||||
|
MwColorGet(cto, &tr, &tg, &tb);
|
||||||
|
MwLLFreeColor(cfrom);
|
||||||
|
MwLLFreeColor(cto);
|
||||||
|
|
||||||
|
memset(d, 255, 1 * TitleBarHeight * 4);
|
||||||
|
|
||||||
|
for(i = 0; i < TitleBarHeight; i++) {
|
||||||
|
d[i * 4 + 0] = fr + (tr - fr) * i / TitleBarHeight;
|
||||||
|
d[i * 4 + 1] = fg + (tg - fg) * i / TitleBarHeight;
|
||||||
|
d[i * 4 + 2] = fb + (tb - fb) * i / TitleBarHeight;
|
||||||
|
}
|
||||||
|
px = MwLoadRaw(widget, d, 1, TitleBarHeight);
|
||||||
|
|
||||||
|
sprintf(tmp_bg, "#%02x%02x%02x", fr + (tr - fr) / 2, fg + (tg - fg) / 2, fb + (tb - fb) / 2);
|
||||||
|
*bg = &tmp_bg[0];
|
||||||
|
|
||||||
|
free(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
n2 = n2->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return px;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wm_focus(MwWidget widget, int focus) {
|
void wm_focus(MwWidget widget, int focus) {
|
||||||
|
|
@ -429,16 +535,19 @@ void wm_focus(MwWidget widget, int focus) {
|
||||||
const char* bg = NULL;
|
const char* bg = NULL;
|
||||||
const char* fg = NULL;
|
const char* fg = NULL;
|
||||||
MwLLPixmap bgpx = NULL;
|
MwLLPixmap bgpx = NULL;
|
||||||
|
MwLLPixmap fgpx = NULL;
|
||||||
|
|
||||||
pthread_mutex_lock(&xmutex);
|
pthread_mutex_lock(&xmutex);
|
||||||
if(focus) {
|
if(focus) {
|
||||||
bgpx = lookup_bg(widget, "Window.TitleBar.Active.Background", &bg);
|
bgpx = lookup_col(widget, "Background", "Active", &bg);
|
||||||
config_lookup_string(&wm_config, "Window.TitleBar.Active.Foreground", &fg);
|
fgpx = lookup_col(widget, "Foreground", "Active", &fg);
|
||||||
} else {
|
} else {
|
||||||
bgpx = lookup_bg(widget, "Window.TitleBar.Inactive.Background", &bg);
|
bgpx = lookup_col(widget, "Background", "Inactive", &bg);
|
||||||
config_lookup_string(&wm_config, "Window.TitleBar.Inactive.Foreground", &fg);
|
fgpx = lookup_col(widget, "Foreground", "Inactive", &fg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(fgpx != NULL) MwLLDestroyPixmap(fgpx);
|
||||||
|
|
||||||
if(f->background != NULL) MwLLDestroyPixmap(f->background);
|
if(f->background != NULL) MwLLDestroyPixmap(f->background);
|
||||||
f->background = bgpx;
|
f->background = bgpx;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,10 +201,29 @@ static Pixmap render_image(Window wnd, const char* path, int tile, int fit) {
|
||||||
|
|
||||||
/* this can be optimized by backends p much, so we do this in backend... */
|
/* this can be optimized by backends p much, so we do this in backend... */
|
||||||
void set_background_x(void) {
|
void set_background_x(void) {
|
||||||
const char* str;
|
const char* str = NULL;
|
||||||
const char* type;
|
const char* type = NULL;
|
||||||
|
xl_node_t* n;
|
||||||
|
|
||||||
if(config_lookup_string(&wm_config, "Wallpaper.Type", &str) && strcmp(str, "Solid") == 0 && config_lookup_string(&wm_config, "Wallpaper.Color", &str)) {
|
if(wm_config == NULL || wm_config->root == NULL) {
|
||||||
|
n = NULL;
|
||||||
|
} else {
|
||||||
|
n = wm_config->root->first_child;
|
||||||
|
}
|
||||||
|
while(n != NULL) {
|
||||||
|
if(n->type == XL_NODE_NODE && strcmp(n->name, "Wallpaper") == 0) {
|
||||||
|
xl_attribute_t* a = n->first_attribute;
|
||||||
|
while(a != NULL) {
|
||||||
|
if(strcmp(a->key, "Type") == 0) type = a->value;
|
||||||
|
a = a->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = n->text;
|
||||||
|
}
|
||||||
|
n = n->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(type != NULL && strcmp(type, "Solid") == 0 && str != NULL) {
|
||||||
MwRGB rgb;
|
MwRGB rgb;
|
||||||
XColor xc;
|
XColor xc;
|
||||||
|
|
||||||
|
|
@ -217,7 +236,7 @@ void set_background_x(void) {
|
||||||
XAllocColor(xdisplay, DefaultColormap(xdisplay, DefaultScreen(xdisplay)), &xc);
|
XAllocColor(xdisplay, DefaultColormap(xdisplay, DefaultScreen(xdisplay)), &xc);
|
||||||
|
|
||||||
XSetWindowBackground(xdisplay, DefaultRootWindow(xdisplay), xc.pixel);
|
XSetWindowBackground(xdisplay, DefaultRootWindow(xdisplay), xc.pixel);
|
||||||
} else if(config_lookup_string(&wm_config, "Wallpaper.Type", &type) && (strcmp(type, "Tile") == 0 || strcmp(type, "Fill") == 0 || strcmp(type, "Fit") == 0) && config_lookup_string(&wm_config, "Wallpaper.Path", &str)) {
|
} else if(type != NULL && (strcmp(type, "Tile") == 0 || strcmp(type, "Fill") == 0 || strcmp(type, "Fit") == 0) && str != NULL) {
|
||||||
XWindowAttributes xwa;
|
XWindowAttributes xwa;
|
||||||
Pixmap px;
|
Pixmap px;
|
||||||
|
|
||||||
|
|
@ -519,6 +538,7 @@ void loop_x(void) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
XWindowAttributes xwa, xwar;
|
XWindowAttributes xwa, xwar;
|
||||||
XConfigureEvent ev2;
|
XConfigureEvent ev2;
|
||||||
|
int mx, my;
|
||||||
|
|
||||||
if(!XGetWindowAttributes(xdisplay, ev.xmaprequest.window, &xwa)) continue;
|
if(!XGetWindowAttributes(xdisplay, ev.xmaprequest.window, &xwa)) continue;
|
||||||
/* ?? ? ? ???? ?? ? ? */
|
/* ?? ? ? ???? ?? ? ? */
|
||||||
|
|
@ -530,7 +550,7 @@ void loop_x(void) {
|
||||||
|
|
||||||
XMapWindow(xdisplay, ev.xmaprequest.window);
|
XMapWindow(xdisplay, ev.xmaprequest.window);
|
||||||
|
|
||||||
if(!xwa.override_redirect) save(ev.xmaprequest.window);
|
if(xwa.override_redirect) save(ev.xmaprequest.window);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -551,6 +571,12 @@ void loop_x(void) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xwa.override_redirect) {
|
||||||
|
wm_destroy(windows[i].frame);
|
||||||
|
arrdel(windows, i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ev2.type = ConfigureNotify;
|
ev2.type = ConfigureNotify;
|
||||||
ev2.display = xdisplay;
|
ev2.display = xdisplay;
|
||||||
ev2.event = windows[i].client;
|
ev2.event = windows[i].client;
|
||||||
|
|
@ -596,7 +622,10 @@ void loop_x(void) {
|
||||||
|
|
||||||
XGetWindowAttributes(xdisplay, DefaultRootWindow(xdisplay), &xwar);
|
XGetWindowAttributes(xdisplay, DefaultRootWindow(xdisplay), &xwar);
|
||||||
|
|
||||||
XMoveWindow(xdisplay, w.client, rand() % (xwar.width - wm_entire_width(xwa.width)), rand() % (xwar.height - wm_entire_height(xwa.height)));
|
mx = (xwar.width - wm_entire_width(xwa.width));
|
||||||
|
my = (xwar.height - wm_entire_height(xwa.height) - 46);
|
||||||
|
|
||||||
|
XMoveWindow(xdisplay, w.client, mx == 0 ? 0 : (rand() % mx), my == 0 ? 0 : (rand() % my));
|
||||||
} else if(ev.type == PropertyNotify) {
|
} else if(ev.type == PropertyNotify) {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < arrlen(windows); i++) {
|
for(i = 0; i < arrlen(windows); i++) {
|
||||||
|
|
@ -610,8 +639,10 @@ void loop_x(void) {
|
||||||
set_name(windows[i].client);
|
set_name(windows[i].client);
|
||||||
}
|
}
|
||||||
} else if(ev.type == MapNotify) {
|
} else if(ev.type == MapNotify) {
|
||||||
int i;
|
int i;
|
||||||
if(ev.xmap.override_redirect) continue;
|
XWindowAttributes xwa;
|
||||||
|
if(!XGetWindowAttributes(xdisplay, ev.xmap.window, &xwa)) continue;
|
||||||
|
if(xwa.override_redirect) continue;
|
||||||
|
|
||||||
for(i = 0; i < arrlen(windows); i++) {
|
for(i = 0; i < arrlen(windows); i++) {
|
||||||
if(windows[i].client == ev.xmap.window) {
|
if(windows[i].client == ev.xmap.window) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue