Commit: d13a194bb78e8dd0b01606dea26c7b1d56574c44
Author: Antony Riakiotakis
Date:   Fri May 30 19:47:08 2014 +0300
https://developer.blender.org/rBd13a194bb78e8dd0b01606dea26c7b1d56574c44

Press and release style interaction for pie menus

works by sending enter press and enter release events. May be somewhat
hacky but it should work.

+ minor cleanup.

===================================================================

M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/interface_intern.h
M       source/blender/editors/interface/interface_regions.c

===================================================================

diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 87de12b..83168f1 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7858,6 +7858,15 @@ static int ui_handle_menu_event(
                if (event->customdata == menu->scrolltimer)
                        ui_menu_scroll(ar, block, my, NULL);
        }
+       else if ((block->flag & UI_BLOCK_RADIAL) && but && (event->type == 
block->event) && event->val == KM_RELEASE) {
+               wmEvent local_event = *event;
+               local_event.type = RETKEY;
+               local_event.val = KM_PRESS;
+               ui_handle_menu_button(C, &local_event, menu);
+               local_event.type = RETKEY;
+               local_event.val = KM_RELEASE;
+               return ui_handle_menu_button(C, &local_event, menu);
+       }
        else {
                /* for ui_mouse_motion_towards_block */
                if (event->type == MOUSEMOVE) {
diff --git a/source/blender/editors/interface/interface_intern.h 
b/source/blender/editors/interface/interface_intern.h
index 2791f37..df56378 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -372,6 +372,7 @@ struct uiBlock {
        int num_pie_items; /* number of pie items, useful to determine 
collision based on how pie items are distributed */
        float pie_center_width; /* width of the central text of the pie menu */
        float pie_dir[2];
+       int event; /* initial event used to fire the pie menu, store here so we 
can query for release */
 };
 
 typedef struct uiSafetyRct {
diff --git a/source/blender/editors/interface/interface_regions.c 
b/source/blender/editors/interface/interface_regions.c
index b1154e4..47216f7 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -2178,11 +2178,6 @@ struct uiPopupMenu {
 struct uiPieMenu {
        uiBlock *block_radial; /* radial block of the pie menu (more could be 
added later) */
        uiLayout *layout;
-
-       /*center coordinates of pie menu in window space */
-       int mx, my;
-       /* event that was used to fire up the pie. Used to detect when to quit 
*/
-       short event;
 };
 
 static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, 
void *arg_pup)
@@ -2490,10 +2485,10 @@ struct uiPieMenu *uiPieMenuBegin(struct bContext *C, 
const char *title, int icon
        pie->block_radial->flag |= UI_BLOCK_POPUP_MEMORY;
        pie->block_radial->puphash = ui_popup_menu_hash(title);
        pie->block_radial->flag |= UI_BLOCK_RADIAL;
+       pie->block_radial->event = event;
 
        pie->layout = uiBlockLayout(pie->block_radial, UI_LAYOUT_VERTICAL, 
UI_LAYOUT_PIEMENU, 0, 0, 200, 0, 0, style);
 
-       pie->event = event;
 
        /* create title button */
        if (title[0]) {
@@ -2521,10 +2516,6 @@ void uiPieMenuEnd(bContext *C, uiPieMenu *pie)
        wmWindow *window = CTX_wm_window(C);
        uiPopupBlockHandle *menu;
 
-       /* initially start pie from mouse position */
-       pie->mx = window->eventstate->x;
-       pie->my = window->eventstate->y;
-
        menu = ui_popup_block_create(C, NULL, NULL, NULL, ui_block_func_PIE, 
pie);
        menu->popup = true;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to