fix some logic

This commit is contained in:
Nishi 2025-12-27 18:36:09 +09:00
commit 089e455448
Signed by: nishi
GPG key ID: 27EF69B208EB9343
2 changed files with 17 additions and 2 deletions

View file

@ -155,7 +155,7 @@ static Pixmap render_image(Window wnd, const char* path, int tile, int fit) {
double sx = (double)w / xwa.width;
double sy = (double)h / xwa.height;
if(fit ? (sx > sy) : (sy < sx)) {
if(fit ? (sx > sy) : (sx < sy)) {
width = w / sx;
height = h / sx;
} else {
@ -517,7 +517,7 @@ void loop_x(void) {
window_t w;
int i;
int ret = 0;
XWindowAttributes xwa;
XWindowAttributes xwa, xwar;
XConfigureEvent ev2;
if(!XGetWindowAttributes(xdisplay, ev.xmaprequest.window, &xwa)) continue;
@ -593,6 +593,10 @@ void loop_x(void) {
set_name(w.client);
}
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)));
} else if(ev.type == PropertyNotify) {
int i;
for(i = 0; i < arrlen(windows); i++) {

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!-- This file should be copied to .config/mpanel/mpanelrc -->
<Panel>
<Module>
<StartButton>
@ -9,6 +10,16 @@
<Application Name="Applications" />
<Separator />
<Execute Name="Terminal">uxterm</Execute>
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
<Execute Name="" />
</Menu>
</StartButton>