mirror of
https://github.com/amiwm/amiwm.git
synced 2026-04-14 11:04:18 +00:00
[amiwm] Fix NULL scr issue
If the clock timer fires when global scr is NULL then we end up calling redrawmenubar() with a NULL global scr, but a valid local scr. So just pass in the scr used when doing "stuff" into redrawmenubar(), making the 'scr' in redrawmenubar() also local scope.
This commit is contained in:
6
frame.c
6
frame.c
@@ -28,7 +28,7 @@ extern Display *dpy;
|
|||||||
extern XContext client_context, screen_context;
|
extern XContext client_context, screen_context;
|
||||||
extern Cursor wm_curs;
|
extern Cursor wm_curs;
|
||||||
extern int shape_extn;
|
extern int shape_extn;
|
||||||
extern void redrawmenubar(Window);
|
extern void redrawmenubar(Scrn *, Window);
|
||||||
void reshape_frame(Client *c);
|
void reshape_frame(Client *c);
|
||||||
|
|
||||||
Window creategadget(Client *c, Window p, int x, int y, int w, int h)
|
Window creategadget(Client *c, Window p, int x, int y, int w, int h)
|
||||||
@@ -510,7 +510,7 @@ void clickenter()
|
|||||||
{
|
{
|
||||||
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
||||||
mbdclick = scr;
|
mbdclick = scr;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else {
|
} else {
|
||||||
scr = clickclient->scr;
|
scr = clickclient->scr;
|
||||||
redraw(clickclient, clickclient->clicked=clickwindow);
|
redraw(clickclient, clickclient->clicked=clickwindow);
|
||||||
@@ -521,7 +521,7 @@ void clickleave()
|
|||||||
{
|
{
|
||||||
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
if((scr=mbdscr)&& clickwindow == scr->menubardepth) {
|
||||||
mbdclick = NULL;
|
mbdclick = NULL;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else {
|
} else {
|
||||||
scr = clickclient->scr;
|
scr = clickclient->scr;
|
||||||
clickclient->clicked=None;
|
clickclient->clicked=None;
|
||||||
|
|||||||
16
main.c
16
main.c
@@ -88,7 +88,7 @@ extern Scrn *mbdclick, *mbdscr;
|
|||||||
extern void reparent(Client *);
|
extern void reparent(Client *);
|
||||||
extern void redraw(Client *, Window);
|
extern void redraw(Client *, Window);
|
||||||
extern void redrawclient(Client *);
|
extern void redrawclient(Client *);
|
||||||
extern void redrawmenubar(Window);
|
extern void redrawmenubar(Scrn *, Window);
|
||||||
extern void gadgetclicked(Client *c, Window w, XEvent *e);
|
extern void gadgetclicked(Client *c, Window w, XEvent *e);
|
||||||
extern void gadgetunclicked(Client *c, XEvent *e);
|
extern void gadgetunclicked(Client *c, XEvent *e);
|
||||||
extern void gadgetaborted(Client *c);
|
extern void gadgetaborted(Client *c);
|
||||||
@@ -283,7 +283,7 @@ void restorescreentitle(Scrn *s)
|
|||||||
{
|
{
|
||||||
(scr=s)->title=s->deftitle;
|
(scr=s)->title=s->deftitle;
|
||||||
XClearWindow(dpy, s->menubar);
|
XClearWindow(dpy, s->menubar);
|
||||||
redrawmenubar(s->menubar);
|
redrawmenubar(s, s->menubar);
|
||||||
if(free_screentitle) {
|
if(free_screentitle) {
|
||||||
free(free_screentitle);
|
free(free_screentitle);
|
||||||
free_screentitle=NULL;
|
free_screentitle=NULL;
|
||||||
@@ -295,7 +295,7 @@ void wberror(Scrn *s, char *message)
|
|||||||
remove_call_out((void(*)(void *))restorescreentitle, s);
|
remove_call_out((void(*)(void *))restorescreentitle, s);
|
||||||
(scr=s)->title=message;
|
(scr=s)->title=message;
|
||||||
XClearWindow(dpy, s->menubar);
|
XClearWindow(dpy, s->menubar);
|
||||||
redrawmenubar(s->menubar);
|
redrawmenubar(s, s->menubar);
|
||||||
XBell(dpy, 100);
|
XBell(dpy, 100);
|
||||||
call_out(2, 0, (void(*)(void *))restorescreentitle, s);
|
call_out(2, 0, (void(*)(void *))restorescreentitle, s);
|
||||||
}
|
}
|
||||||
@@ -828,7 +828,7 @@ static void update_clock(void *dontcare)
|
|||||||
|
|
||||||
scr = get_front_scr();
|
scr = get_front_scr();
|
||||||
do {
|
do {
|
||||||
redrawmenubar(scr->menubar);
|
redrawmenubar(scr, scr->menubar);
|
||||||
scr=scr->behind;
|
scr=scr->behind;
|
||||||
} while(scr != get_front_scr());
|
} while(scr != get_front_scr());
|
||||||
}
|
}
|
||||||
@@ -1001,7 +1001,7 @@ int main(int argc, char *argv[])
|
|||||||
else if(i)
|
else if(i)
|
||||||
redrawicon(i, event.xexpose.window);
|
redrawicon(i, event.xexpose.window);
|
||||||
else if(scr)
|
else if(scr)
|
||||||
redrawmenubar(event.xexpose.window);
|
redrawmenubar(scr, event.xexpose.window);
|
||||||
if((rubberclient || boundingscr)&&!prefs.opaquemove) drawrubber();
|
if((rubberclient || boundingscr)&&!prefs.opaquemove) drawrubber();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1337,7 +1337,7 @@ int main(int argc, char *argv[])
|
|||||||
} else if(scr&&event.xbutton.window==scr->menubardepth) {
|
} else if(scr&&event.xbutton.window==scr->menubardepth) {
|
||||||
clickwindow=scr->menubardepth;
|
clickwindow=scr->menubardepth;
|
||||||
mbdclick=mbdscr=scr;
|
mbdclick=mbdscr=scr;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else if(scr&&event.xbutton.window==scr->menubar &&
|
} else if(scr&&event.xbutton.window==scr->menubar &&
|
||||||
scr->back!=scr->root) {
|
scr->back!=scr->root) {
|
||||||
startscreendragging(scr, &event);
|
startscreendragging(scr, &event);
|
||||||
@@ -1352,7 +1352,7 @@ int main(int argc, char *argv[])
|
|||||||
else if(scr&&(scr==mbdscr)&&clickwindow==scr->menubardepth) {
|
else if(scr&&(scr==mbdscr)&&clickwindow==scr->menubardepth) {
|
||||||
mbdclick=NULL;
|
mbdclick=NULL;
|
||||||
clickwindow=None;
|
clickwindow=None;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
} else if(clickclient)
|
} else if(clickclient)
|
||||||
gadgetaborted(clickclient);
|
gadgetaborted(clickclient);
|
||||||
else if(dragiconlist)
|
else if(dragiconlist)
|
||||||
@@ -1386,7 +1386,7 @@ int main(int argc, char *argv[])
|
|||||||
else if((scr=mbdscr)&& clickwindow==scr->menubardepth) {
|
else if((scr=mbdscr)&& clickwindow==scr->menubardepth) {
|
||||||
if(mbdclick) {
|
if(mbdclick) {
|
||||||
mbdclick=NULL;
|
mbdclick=NULL;
|
||||||
redrawmenubar(scr->menubardepth);
|
redrawmenubar(scr, scr->menubardepth);
|
||||||
screentoback();
|
screentoback();
|
||||||
}
|
}
|
||||||
clickwindow=None;
|
clickwindow=None;
|
||||||
|
|||||||
2
menu.c
2
menu.c
@@ -494,7 +494,7 @@ void createmenubar()
|
|||||||
* This takes in the target window, which may be the basic menubar,
|
* This takes in the target window, which may be the basic menubar,
|
||||||
* a clicked-on menu, or the depth widget.
|
* a clicked-on menu, or the depth widget.
|
||||||
*/
|
*/
|
||||||
void redrawmenubar(Window w)
|
void redrawmenubar(Scrn *scr, Window w)
|
||||||
{
|
{
|
||||||
static const char defaultTimeFormat[] = "%c";
|
static const char defaultTimeFormat[] = "%c";
|
||||||
int widget_rhs;
|
int widget_rhs;
|
||||||
|
|||||||
Reference in New Issue
Block a user