Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: borders.c borders.h cursors.c cursors.h events.c ewins.c grabs.c ipc.c moveresize.c Log Message: Clean up move/resize event handling. =================================================================== RCS file: /cvs/e/e16/e/src/borders.c,v retrieving revision 1.291 retrieving revision 1.292 diff -u -3 -r1.291 -r1.292 --- borders.c 26 Nov 2006 11:30:58 -0000 1.291 +++ borders.c 26 Nov 2006 17:10:40 -0000 1.292 @@ -917,7 +917,7 @@ /* Beware! Actions may destroy the current border */ wbit->left = 0; - if (WinGetXwin(wbit->win) == Mode.events.last_bpress && !left && + if (ev && WinGetXwin(wbit->win) == Mode.events.last_bpress && !left && ewin->border->part[part].aclass) ActionclassEvent(ewin->border->part[part].aclass, ev, ewin); } @@ -963,6 +963,25 @@ BorderWinpartChange(ewin, part, 0); if (ewin->border->part[part].aclass) ActionclassEvent(ewin->border->part[part].aclass, ev, ewin); + } +} + +void +BorderCheckState(EWin * ewin, XEvent * ev) +{ + int i; + + for (i = 0; i < ewin->border->num_winparts; i++) + { + switch (ev->type) + { + default: + break; + + case ButtonRelease: + BorderWinpartEventMouseUp(ewin->bits + i, NULL); + break; + } } } =================================================================== RCS file: /cvs/e/e16/e/src/borders.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -3 -r1.6 -r1.7 --- borders.h 29 Apr 2006 19:39:20 -0000 1.6 +++ borders.h 26 Nov 2006 17:10:40 -0000 1.7 @@ -104,6 +104,7 @@ void EwinSetBorder(EWin * ewin, const Border * b, int apply); void EwinSetBorderByName(EWin * ewin, const char *name); int BorderWinpartIndex(EWin * ewin, Win win); +void BorderCheckState(EWin * ewin, XEvent * ev); Border *BorderCreateFiller(int left, int right, int top, int bottom); void BordersForeach(void (*func) (Border * b, void *data), =================================================================== RCS file: /cvs/e/e16/e/src/cursors.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -3 -r1.37 -r1.38 --- cursors.c 19 Nov 2006 21:55:51 -0000 1.37 +++ cursors.c 26 Nov 2006 17:10:40 -0000 1.38 @@ -256,17 +256,20 @@ } static Cursor -ECursorGetByName(const char *name, unsigned int fallback) +ECursorGetByName(const char *name, const char *name2, unsigned int fallback) { ECursor *ec; ec = ECursorFind(name); - if (!ec) - return XCreateFontCursor(disp, fallback); - - ECursorIncRefcount(ec); + if (!ec && name2) + ec = ECursorFind(name2); + if (ec) + { + ECursorIncRefcount(ec); + return ec->cursor; + } - return ec->cursor; + return XCreateFontCursor(disp, fallback); } void @@ -312,11 +315,23 @@ CursorsInit(void) { ECsrs[ECSR_NONE] = None; - ECsrs[ECSR_ROOT] = ECursorGetByName("DEFAULT", XC_left_ptr); - ECsrs[ECSR_GRAB] = ECursorGetByName("GRAB", XC_crosshair); - ECsrs[ECSR_PGRAB] = ECursorGetByName("PGRAB", XC_X_cursor); - ECsrs[ECSR_ACT_MOVE] = ECursorGetByName("GRAB_MOVE", XC_fleur); - ECsrs[ECSR_ACT_RESIZE] = ECursorGetByName("GRAB_RESIZE", XC_sizing); + ECsrs[ECSR_ROOT] = ECursorGetByName("DEFAULT", NULL, XC_left_ptr); + ECsrs[ECSR_GRAB] = ECursorGetByName("GRAB", NULL, XC_crosshair); + ECsrs[ECSR_PGRAB] = ECursorGetByName("PGRAB", NULL, XC_X_cursor); + ECsrs[ECSR_ACT_MOVE] = ECursorGetByName("GRAB_MOVE", NULL, XC_fleur); + ECsrs[ECSR_ACT_RESIZE] = ECursorGetByName("GRAB_RESIZE", NULL, XC_sizing); + ECsrs[ECSR_ACT_RESIZE_H] = + ECursorGetByName("RESIZE_H", NULL, XC_sb_h_double_arrow); + ECsrs[ECSR_ACT_RESIZE_V] = + ECursorGetByName("RESIZE_V", NULL, XC_sb_v_double_arrow); + ECsrs[ECSR_ACT_RESIZE_TL] = + ECursorGetByName("RESIZE_TL", "RESIZE_BR", XC_top_left_corner); + ECsrs[ECSR_ACT_RESIZE_TR] = + ECursorGetByName("RESIZE_TR", "RESIZE_BL", XC_top_right_corner); + ECsrs[ECSR_ACT_RESIZE_BL] = + ECursorGetByName("RESIZE_BL", "RESIZE_TR", XC_bottom_left_corner); + ECsrs[ECSR_ACT_RESIZE_BR] = + ECursorGetByName("RESIZE_BR", "RESIZE_TL", XC_bottom_right_corner); } /* =================================================================== RCS file: /cvs/e/e16/e/src/cursors.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -3 -r1.1 -r1.2 --- cursors.h 19 Nov 2006 21:55:51 -0000 1.1 +++ cursors.h 26 Nov 2006 17:10:40 -0000 1.2 @@ -33,7 +33,13 @@ #define ECSR_PGRAB 3 #define ECSR_ACT_MOVE 4 #define ECSR_ACT_RESIZE 5 -#define ECSR_COUNT 6 +#define ECSR_ACT_RESIZE_H 6 +#define ECSR_ACT_RESIZE_V 7 +#define ECSR_ACT_RESIZE_TL 8 +#define ECSR_ACT_RESIZE_TR 9 +#define ECSR_ACT_RESIZE_BL 10 +#define ECSR_ACT_RESIZE_BR 11 +#define ECSR_COUNT 12 ECursor *ECursorFind(const char *name); void ECursorApply(ECursor * ec, Win win); =================================================================== RCS file: /cvs/e/e16/e/src/events.c,v retrieving revision 1.130 retrieving revision 1.131 diff -u -3 -r1.130 -r1.131 --- events.c 20 Nov 2006 17:32:12 -0000 1.130 +++ events.c 26 Nov 2006 17:10:40 -0000 1.131 @@ -25,7 +25,6 @@ #include "aclass.h" #include "emodule.h" #include "events.h" -#include "ewins.h" #include "session.h" #include "timers.h" #include "xwin.h" @@ -275,8 +274,6 @@ Mode.events.py = Mode.events.y; ModeGetXY(ev->xmotion.root, ev->xmotion.x_root, ev->xmotion.y_root); Mode.events.on_screen = ev->xmotion.same_screen; - - ActionsHandleMotion(); break; case EnterNotify: @@ -336,7 +333,6 @@ break; case ButtonRelease: /* 5 */ SoundPlay("SOUND_BUTTON_RAISE"); - ActionsEnd(NULL); break; } =================================================================== RCS file: /cvs/e/e16/e/src/ewins.c,v retrieving revision 1.183 retrieving revision 1.184 diff -u -3 -r1.183 -r1.184 --- ewins.c 26 Nov 2006 14:40:05 -0000 1.183 +++ ewins.c 26 Nov 2006 17:10:40 -0000 1.184 @@ -2028,7 +2028,9 @@ ActionsCheck("BUTTONBINDINGS", ewin, ev); break; case ButtonRelease: + ActionsEnd(NULL); ActionsCheck("BUTTONBINDINGS", ewin, ev); + BorderCheckState(ewin, ev); break; case EnterNotify: FocusHandleEnter(ewin, ev); @@ -2037,6 +2039,7 @@ FocusHandleLeave(ewin, ev); break; case MotionNotify: + ActionsHandleMotion(); break; default: #if DEBUG_EWIN_EVENTS =================================================================== RCS file: /cvs/e/e16/e/src/grabs.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -3 -r1.28 -r1.29 --- grabs.c 19 Nov 2006 21:55:51 -0000 1.28 +++ grabs.c 26 Nov 2006 17:10:40 -0000 1.29 @@ -57,7 +57,7 @@ GrabPointerSet(Win win, unsigned int csr, int confine) { int ret = -1; - Window confine_to = (confine) ? WinGetXwin(win) : None; + Window confine_to = (confine) ? VRoot.xwin : None; ret = XGrabPointer(disp, WinGetXwin(win), False, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | =================================================================== RCS file: /cvs/e/e16/e/src/ipc.c,v retrieving revision 1.284 retrieving revision 1.285 diff -u -3 -r1.284 -r1.285 --- ipc.c 26 Nov 2006 14:46:09 -0000 1.284 +++ ipc.c 26 Nov 2006 17:10:40 -0000 1.285 @@ -697,15 +697,15 @@ if (!strcmp(param1, "ptr")) { - ActionResizeStart(ewin, 0, MODE_RESIZE); + ActionResizeStart(ewin, 1, MODE_RESIZE); } else if (!strcmp(param1, "ptr-h")) { - ActionResizeStart(ewin, 0, MODE_RESIZE_H); + ActionResizeStart(ewin, 1, MODE_RESIZE_H); } else if (!strcmp(param1, "ptr-v")) { - ActionResizeStart(ewin, 0, MODE_RESIZE_V); + ActionResizeStart(ewin, 1, MODE_RESIZE_V); } else if (!strcmp(param1, "?")) { =================================================================== RCS file: /cvs/e/e16/e/src/moveresize.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -3 -r1.71 -r1.72 --- moveresize.c 19 Nov 2006 21:55:52 -0000 1.71 +++ moveresize.c 26 Nov 2006 17:10:40 -0000 1.72 @@ -80,10 +80,7 @@ SoundPlay("SOUND_MOVE_START"); if (grab) - { - GrabPointerRelease(); - GrabPointerSet(VRoot.win, ECSR_ACT_MOVE, 1); - } + GrabPointerSet(EoGetWin(ewin), ECSR_ACT_MOVE, 1); Mode.mode = MODE_MOVE_PENDING; Mode.constrained = constrained; @@ -271,6 +268,7 @@ ActionResizeStart(EWin * ewin, int grab, int hv) { int x, y, w, h, ww, hh; + unsigned int csr; if (!ewin || ewin->state.inhibit_resize) return 0; @@ -294,14 +292,9 @@ EwinUpdateOpacity(ewin); } - if (grab) - { - GrabPointerRelease(); - GrabPointerSet(VRoot.win, ECSR_ACT_RESIZE, 1); - } - switch (hv) { + default: case MODE_RESIZE: Mode.mode = hv; x = Mode.events.x - EoGetX(ewin); @@ -311,14 +304,27 @@ ww = EoGetW(ewin) / 6; hh = EoGetH(ewin) / 6; + csr = ECSR_ACT_RESIZE; if ((x < w) && (y < h)) - Mode_mr.resize_detail = 0; - if ((x >= w) && (y < h)) - Mode_mr.resize_detail = 1; - if ((x < w) && (y >= h)) - Mode_mr.resize_detail = 2; - if ((x >= w) && (y >= h)) - Mode_mr.resize_detail = 3; + { + Mode_mr.resize_detail = 0; + csr = ECSR_ACT_RESIZE_TL; + } + else if ((x >= w) && (y < h)) + { + Mode_mr.resize_detail = 1; + csr = ECSR_ACT_RESIZE_TR; + } + else if ((x < w) && (y >= h)) + { + Mode_mr.resize_detail = 2; + csr = ECSR_ACT_RESIZE_BL; + } + else if ((x >= w) && (y >= h)) + { + Mode_mr.resize_detail = 3; + csr = ECSR_ACT_RESIZE_BR; + } /* The following four if statements added on 07/22/04 by Josh Holtrop. * They allow strictly horizontal or vertical resizing when the @@ -327,21 +333,25 @@ { Mode.mode = MODE_RESIZE_V; Mode_mr.resize_detail = 0; + csr = ECSR_ACT_RESIZE_V; } else if ((abs(x - w) < (w >> 1)) && (y > (EoGetH(ewin) - hh))) { Mode.mode = MODE_RESIZE_V; Mode_mr.resize_detail = 1; + csr = ECSR_ACT_RESIZE_V; } else if ((abs(y - h) < (h >> 1)) && (x < ww)) { Mode.mode = MODE_RESIZE_H; Mode_mr.resize_detail = 0; + csr = ECSR_ACT_RESIZE_H; } else if ((abs(y - h) < (h >> 1)) && (x > (EoGetW(ewin) - ww))) { Mode.mode = MODE_RESIZE_H; Mode_mr.resize_detail = 1; + csr = ECSR_ACT_RESIZE_H; } break; @@ -353,6 +363,7 @@ Mode_mr.resize_detail = 0; else Mode_mr.resize_detail = 1; + csr = ECSR_ACT_RESIZE_H; break; case MODE_RESIZE_V: @@ -363,6 +374,7 @@ Mode_mr.resize_detail = 0; else Mode_mr.resize_detail = 1; + csr = ECSR_ACT_RESIZE_V; break; } @@ -372,6 +384,10 @@ Mode_mr.win_y = EoGetY(ewin); Mode_mr.win_w = ewin->client.w; Mode_mr.win_h = ewin->client.h; + + if (grab) + GrabPointerSet(EoGetWin(ewin), csr, 1); + EwinShapeSet(ewin); ewin->state.show_coords = 1; DrawEwinShape(ewin, Conf.movres.mode_resize, EoGetX(ewin), EoGetY(ewin), ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs