sgl
diff src/wsys_x11.c @ 6:0cb438c86b98
X11 sounds about ready
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Fri, 13 May 2011 09:44:21 +0300 |
parents | 0570e27e5ebc |
children | edbfc96fe80d |
line diff
1.1 --- a/src/wsys_x11.c Fri May 13 07:49:47 2011 +0300 1.2 +++ b/src/wsys_x11.c Fri May 13 09:44:21 2011 +0300 1.3 @@ -139,6 +139,7 @@ 1.4 unsigned int attr_valid; 1.5 long evmask; 1.6 struct window *wnode; 1.7 + void (*func)(); 1.8 1.9 if(!(wnode = malloc(sizeof *wnode))) { 1.10 return -1; 1.11 @@ -198,7 +199,17 @@ 1.12 1.13 if(!active_win) { 1.14 set_active(win); 1.15 + } else { 1.16 + activate_window(wnode); 1.17 } 1.18 + 1.19 + if((func = sgl_get_callback(SGL_CREATE))) { 1.20 + func(win); 1.21 + } 1.22 + if((func = sgl_get_callback(SGL_RESHAPE))) { 1.23 + func(xsz, ysz); 1.24 + } 1.25 + activate_window(prev_active); 1.26 return win; 1.27 } 1.28 1.29 @@ -263,6 +274,8 @@ 1.30 static void close_window(int id) 1.31 { 1.32 struct window dummy, *win, *prev; 1.33 + sgl_close_callback_t close_func; 1.34 + 1.35 dummy.next = winlist; 1.36 1.37 prev = &dummy; 1.38 @@ -270,6 +283,9 @@ 1.39 1.40 while(win) { 1.41 if(win->win == id) { 1.42 + if(!(close_func = sgl_get_callback(SGL_CLOSE))) { 1.43 + close_func(id); 1.44 + } 1.45 glXDestroyContext(dpy, win->ctx); 1.46 XDestroyWindow(dpy, win->win); 1.47 prev->next = win->next; 1.48 @@ -465,7 +481,7 @@ 1.49 func = sgl_get_callback(SGL_PASSIVE); 1.50 } 1.51 if(func) { 1.52 - func(xev->xmotion.x, xev->xmotion.y); 1.53 + func(0, xev->xmotion.x, xev->xmotion.y); 1.54 } 1.55 break; 1.56 1.57 @@ -478,7 +494,7 @@ 1.58 } 1.59 if((func = sgl_get_callback(SGL_MOUSE))) { 1.60 int bn = xev->xbutton.button - 1; 1.61 - func(bn, state, xev->xbutton.x, xev->xbutton.y); 1.62 + func(0, bn, state, xev->xbutton.x, xev->xbutton.y); 1.63 } 1.64 break; 1.65