[layout] Stop starting a thread for layout freshing

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-27 11:01:57 +02:00
parent 8d0f2bcb07
commit 7cdba19a56
4 changed files with 10 additions and 13 deletions

View File

@ -294,7 +294,7 @@ main(int argc, char **argv)
xcb_generic_event_t *ev; xcb_generic_event_t *ev;
struct sockaddr_un *addr; struct sockaddr_un *addr;
client_t *c; client_t *c;
pthread_t tid_layout, tid_statusbar; pthread_t tid_statusbar;
static struct option long_options[] = static struct option long_options[] =
{ {
{"help", 0, NULL, 'h'}, {"help", 0, NULL, 'h'},
@ -484,7 +484,7 @@ main(int argc, char **argv)
/* refresh everything before waiting events */ /* refresh everything before waiting events */
statusbar_refresh(NULL); statusbar_refresh(NULL);
layout_refresh(NULL); layout_refresh();
/* initialize Glib for thread safeness */ /* initialize Glib for thread safeness */
g_thread_init(NULL); g_thread_init(NULL);
@ -541,17 +541,15 @@ main(int argc, char **argv)
} while((ev = xcb_poll_for_event(globalconf.connection))); } while((ev = xcb_poll_for_event(globalconf.connection)));
a_thread_refresh(&tid_statusbar, &statusbar_refresh); a_thread_refresh(&tid_statusbar, &statusbar_refresh);
a_thread_refresh(&tid_layout, &layout_refresh); layout_refresh();
pthread_join(tid_statusbar, NULL); pthread_join(tid_statusbar, NULL);
pthread_join(tid_layout, NULL);
/* need to resync */ /* need to resync */
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }
a_thread_refresh(&tid_statusbar, &statusbar_refresh); a_thread_refresh(&tid_statusbar, &statusbar_refresh);
a_thread_refresh(&tid_layout, &layout_refresh); layout_refresh();
pthread_join(tid_statusbar, NULL); pthread_join(tid_statusbar, NULL);
pthread_join(tid_layout, NULL);
xcb_aux_sync(globalconf.connection); xcb_aux_sync(globalconf.connection);
} }

View File

@ -101,15 +101,14 @@ arrange(int screen)
/** Refresh the screen disposition /** Refresh the screen disposition
* \return true if the screen was arranged, false otherwise * \return true if the screen was arranged, false otherwise
*/ */
void * void
layout_refresh(void *v __attribute__ ((unused))) layout_refresh(void)
{ {
int screen; int screen;
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++) for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
if(globalconf.screens[screen].need_arrange) if(globalconf.screens[screen].need_arrange)
arrange(screen); arrange(screen);
return NULL;
} }
/** Get current layout used on screen. /** Get current layout used on screen.

View File

@ -28,7 +28,7 @@
typedef void (layout_t)(int); typedef void (layout_t)(int);
layout_t * layout_get_current(int); layout_t * layout_get_current(int);
void * layout_refresh(void *); void layout_refresh(void);
#endif #endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -284,14 +284,14 @@ mouse_client_move(client_t *c, int snap)
move_client_to_screen(c, newscreen, true); move_client_to_screen(c, newscreen, true);
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;
globalconf.screens[newscreen].need_arrange = true; globalconf.screens[newscreen].need_arrange = true;
layout_refresh(NULL); layout_refresh();
} }
if((target = client_get_bywin(globalconf.clients, mquery_pointer_r->child)) if((target = client_get_bywin(globalconf.clients, mquery_pointer_r->child))
&& target != c && !target->isfloating) && target != c && !target->isfloating)
{ {
client_list_swap(&globalconf.clients, c, target); client_list_swap(&globalconf.clients, c, target);
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;
layout_refresh(NULL); layout_refresh();
} }
p_delete(&mquery_pointer_r); p_delete(&mquery_pointer_r);
} }
@ -436,7 +436,7 @@ mouse_client_resize(client_t *c)
{ {
curtags[0]->mwfact = mwfact; curtags[0]->mwfact = mwfact;
globalconf.screens[c->screen].need_arrange = true; globalconf.screens[c->screen].need_arrange = true;
layout_refresh(NULL); layout_refresh();
} }
} }
p_delete(&ev); p_delete(&ev);