Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: iclass.c tclass.c x.c xwin.h Log Message: Add sanity checks. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v retrieving revision 1.81 retrieving revision 1.82 diff -u -3 -r1.81 -r1.82 --- iclass.c 30 Oct 2005 19:40:49 -0000 1.81 +++ iclass.c 20 Nov 2005 22:47:40 -0000 1.82 @@ -1561,8 +1561,9 @@ int st, w = -1, h = -1; winptr = atword(params, 3); + win = (Window) strtoul(winptr, NULL, 0); + word(params, 4, state); - win = (Window) strtol(winptr, (char **)NULL, 0); if (!strcmp(state, "hilited")) st = STATE_HILITED; else if (!strcmp(state, "clicked")) @@ -1571,12 +1572,16 @@ st = STATE_DISABLED; else st = STATE_NORMAL; + hptr = atword(params, 6); if (hptr) { w = (int)strtol(atword(params, 5), (char **)NULL, 0); h = (int)strtol(hptr, (char **)NULL, 0); } + + if (!EDrawableCheck(win, 0)) /* Grab server? */ + return; ImageclassApply(ic, win, w, h, 0, 0, st, 0, ST_SOLID); } } @@ -1589,10 +1594,12 @@ char state[20]; const char *winptr, *hptr; int st, w = -1, h = -1; + PmapMask pmm; winptr = atword(params, 3); + win = (Window) strtoul(winptr, NULL, 0); + word(params, 4, state); - win = (Window) strtol(winptr, (char **)NULL, 0); if (!strcmp(state, "hilited")) st = STATE_HILITED; else if (!strcmp(state, "clicked")) @@ -1601,21 +1608,22 @@ st = STATE_DISABLED; else st = STATE_NORMAL; + hptr = atword(params, 6); if (!hptr) - IpcPrintf("Error: missing width and/or height\n"); - else { - PmapMask pmm; - - w = (int)strtol(atword(params, 5), (char **)NULL, 0); - h = (int)strtol(hptr, (char **)NULL, 0); - ImageclassApplyCopy(ic, win, w, h, 0, 0, st, - &pmm, 1, ST_SOLID); - IpcPrintf("0x%08x 0x%08x\n", - (unsigned)pmm.pmap, (unsigned)pmm.mask); -/* FreePmapMask(&pmm); ??? */ + IpcPrintf("Error: missing width and/or height\n"); + return; } + + w = (int)strtol(atword(params, 5), (char **)NULL, 0); + h = (int)strtol(hptr, (char **)NULL, 0); + + if (!EDrawableCheck(win, 0)) /* Grab server? */ + return; + ImageclassApplyCopy(ic, win, w, h, 0, 0, st, &pmm, 1, ST_SOLID); + IpcPrintf("0x%08lx 0x%08lx\n", pmm.pmap, pmm.mask); +/* FreePmapMask(&pmm); ??? */ } } else if (!strcmp(param2, "ref_count")) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/tclass.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -3 -r1.37 -r1.38 --- tclass.c 30 Oct 2005 19:40:49 -0000 1.37 +++ tclass.c 20 Nov 2005 22:47:41 -0000 1.38 @@ -568,11 +568,13 @@ Window win; word(params, 3, param3); - win = (Window) strtol(param3, (char **)NULL, 0); + win = (Window) strtoul(param3, NULL, 0); + word(params, 4, param3); x = atoi(param3); word(params, 5, param3); y = atoi(param3); + word(params, 6, param3); state = STATE_NORMAL; if (!strcmp(param3, "normal")) @@ -583,9 +585,14 @@ state = STATE_CLICKED; else if (!strcmp(param3, "disabled")) state = STATE_DISABLED; + txt = atword(params, 7); - if (txt) - TextDraw(tc, win, 0, 0, state, txt, x, y, 99999, 99999, 17, 0); + if (!txt) + return; + + if (!EDrawableCheck(win, 0)) /* Grab server? */ + return; + TextDraw(tc, win, 0, 0, state, txt, x, y, 99999, 99999, 17, 0); } } else if (!strcmp(param2, "query_size")) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v retrieving revision 1.112 retrieving revision 1.113 diff -u -3 -r1.112 -r1.113 --- x.c 30 Oct 2005 19:40:49 -0000 1.112 +++ x.c 20 Nov 2005 22:47:41 -0000 1.113 @@ -883,6 +883,22 @@ XSelectInput(disp, win, xwa.your_event_mask); } +int +EDrawableCheck(Drawable draw, int grab) +{ + int ok; + + if (grab) + EGrabServer(); + + ok = EGetGeometry(draw, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + if (grab && !ok) + EUngrabServer(); + + return ok; +} + #define DEBUG_SHAPE_OPS 0 #define DEBUG_SHAPE_PROPAGATE 0 =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/xwin.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- xwin.h 16 Oct 2005 16:27:48 -0000 1.7 +++ xwin.h 20 Nov 2005 22:47:41 -0000 1.8 @@ -81,6 +81,7 @@ void EWarpPointer(Window win, int x, int y); Bool EQueryPointer(Window win, int *px, int *py, Window * pchild, unsigned int *pmask); +int EDrawableCheck(Drawable draw, int grab); #define ESelectInput(win, mask) XSelectInput(disp, win, mask) #define EGetWindowAttributes(win, attr) XGetWindowAttributes(disp, win, attr) ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs