Update handle_configure_request() to not modify tmp_win before calling SetUpFrame(), plus reduced vars used. Issue #25

This commit is contained in:
Morgan Aldridge 2021-09-05 11:07:17 -04:00
parent b039615084
commit 692432b807

View File

@ -383,7 +383,7 @@ void handle_configure_request( XEvent *ev )
unsigned long xwcm; unsigned long xwcm;
MlvwmWindow *tmp_win; MlvwmWindow *tmp_win;
XConfigureRequestEvent *xcr = &ev->xconfigurerequest; XConfigureRequestEvent *xcr = &ev->xconfigurerequest;
int x, y, width, height, old_x, old_y; int x, y, width, height;
int title_height, sbar_v, sbar_h; int title_height, sbar_v, sbar_h;
Bool notify=False; Bool notify=False;
@ -418,8 +418,6 @@ void handle_configure_request( XEvent *ev )
x = tmp_win->frame_x; x = tmp_win->frame_x;
y = tmp_win->frame_y; y = tmp_win->frame_y;
old_x = x;
old_y = y;
width = tmp_win->frame_w; width = tmp_win->frame_w;
height = tmp_win->frame_h; height = tmp_win->frame_h;
@ -442,23 +440,20 @@ void handle_configure_request( XEvent *ev )
if (xcr->value_mask & CWHeight) height = xcr->height+12; if (xcr->value_mask & CWHeight) height = xcr->height+12;
} }
tmp_win->frame_x = x<0 ? 0 : x; // prevent windows from being moved above menu bar
tmp_win->frame_y = y<MENUB_H ? MENUB_H : y; if (y < MENUB_H)
y = MENUB_H;
tmp_win->win_w = width; if( tmp_win->frame_x!=x || tmp_win->frame_y!=y ) notify = True;
tmp_win->win_h = height;
if( old_x!=x || old_y!=y ) notify = True;
if( !(tmp_win->flags&SCROLL) || if( !(tmp_win->flags&SCROLL) ||
tmp_win->frame_w>tmp_win->win_w || !(tmp_win->flags&SBARH) ) width>tmp_win->win_w || !(tmp_win->flags&SBARH) )
tmp_win->frame_w = tmp_win->win_w; width = tmp_win->win_w;
if( !(tmp_win->flags&SCROLL) || if( !(tmp_win->flags&SCROLL) ||
tmp_win->frame_h>tmp_win->win_h || !(tmp_win->flags&SBARV) ) height>tmp_win->win_h || !(tmp_win->flags&SBARV) )
tmp_win->frame_h = tmp_win->win_h; height = tmp_win->win_h;
SetUpFrame(tmp_win, tmp_win->frame_x, tmp_win->frame_y, SetUpFrame(tmp_win, x, y, width, height, notify );
tmp_win->frame_w, tmp_win->frame_h, notify );
if( tmp_win==Scr.ActiveWin ){ if( tmp_win==Scr.ActiveWin ){
Scr.ActiveWin = NULL; Scr.ActiveWin = NULL;