2.5:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Jan 2009 19:42:49 +0000 (19:42 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Wed, 28 Jan 2009 19:42:49 +0000 (19:42 +0000)
* Fix using enter key for selecting item in a submenu.
* Fix some non working buttons in nodes.
* Fix memory leak when using glsl.
* Change triple buffer proxy test a bit, hopefully this succeeds
  on more cards now.

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_handlers.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_init_exit.c

index f4696cab08c0873f52dad9306949bee4ad3ad54a..d2c1e6859cbe3562bb68a826949a9ba6edc6bba7 100644 (file)
@@ -433,8 +433,8 @@ static int ui_but_equals_old(uiBut *but, uiBut *oldbut)
        if(but->rnaprop != oldbut->rnaprop)
        if(but->rnaindex != oldbut->rnaindex) return 0;
        if(but->func != oldbut->func) return 0;
-       if(but->func_arg1 != oldbut->func_arg1) return 0;
-       if(but->func_arg2 != oldbut->func_arg2) return 0;
+       if(oldbut->func_arg1 != oldbut && but->func_arg1 != oldbut->func_arg1) return 0;
+       if(oldbut->func_arg2 != oldbut && but->func_arg2 != oldbut->func_arg2) return 0;
 
        return 1;
 }
index bfe6057cfce429114fa865435d491b91d6142a77..85735a420266a4ff14a6be3773168347ebb0dcb9 100644 (file)
@@ -157,6 +157,51 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
 static int ui_handler_region_menu(bContext *C, wmEvent *event, void *userdata);
 static int ui_handler_popup(bContext *C, wmEvent *event, void *userdata);
 static void ui_handler_remove_popup(bContext *C, void *userdata);
+static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiButtonActivateType type);
+
+/* ******************** menu navigation helpers ************** */
+
+static uiBut *ui_but_prev(uiBut *but)
+{
+       while(but->prev) {
+               but= but->prev;
+               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+       }
+       return NULL;
+}
+
+static uiBut *ui_but_next(uiBut *but)
+{
+       while(but->next) {
+               but= but->next;
+               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+       }
+       return NULL;
+}
+
+static uiBut *ui_but_first(uiBlock *block)
+{
+       uiBut *but;
+       
+       but= block->buttons.first;
+       while(but) {
+               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+               but= but->next;
+       }
+       return NULL;
+}
+
+static uiBut *ui_but_last(uiBlock *block)
+{
+       uiBut *but;
+       
+       but= block->buttons.last;
+       while(but) {
+               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
+               but= but->prev;
+       }
+       return NULL;
+}
 
 /* ********************** button apply/revert ************************/
 
@@ -2892,8 +2937,23 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
 
        button_activate_state(C, but, BUTTON_STATE_HIGHLIGHT);
 
-       if(type == BUTTON_ACTIVATE_OPEN)
+       if(type == BUTTON_ACTIVATE_OPEN) {
                button_activate_state(C, but, BUTTON_STATE_MENU_OPEN);
+
+               /* activate first button in submenu */
+               if(data->menu && data->menu->region) {
+                       ARegion *subar= data->menu->region;
+                       uiBlock *subblock= subar->uiblocks.first;
+                       uiBut *subbut;
+                       
+                       if(subblock) {
+                               subbut= ui_but_first(subblock);
+
+                               if(subbut)
+                                       ui_handle_button_activate(C, subar, subbut, BUTTON_ACTIVATE);
+                       }
+               }
+       }
        else if(type == BUTTON_ACTIVATE_TEXT_EDITING)
                button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
        else if(type == BUTTON_ACTIVATE_APPLY)
@@ -3155,50 +3215,6 @@ static void ui_handle_button_closed_submenu(bContext *C, wmEvent *event, uiBut *
        }
 }
 
-/* ******************** menu navigation helpers ************** */
-
-static uiBut *ui_but_prev(uiBut *but)
-{
-       while(but->prev) {
-               but= but->prev;
-               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
-       }
-       return NULL;
-}
-
-static uiBut *ui_but_next(uiBut *but)
-{
-       while(but->next) {
-               but= but->next;
-               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
-       }
-       return NULL;
-}
-
-static uiBut *ui_but_first(uiBlock *block)
-{
-       uiBut *but;
-       
-       but= block->buttons.first;
-       while(but) {
-               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
-               but= but->next;
-       }
-       return NULL;
-}
-
-static uiBut *ui_but_last(uiBlock *block)
-{
-       uiBut *but;
-       
-       but= block->buttons.last;
-       while(but) {
-               if(but->type!=LABEL && but->type!=SEPR && but->type!=ROUNDBOX) return but;
-               but= but->prev;
-       }
-       return NULL;
-}
-
 /* ************************* menu handling *******************************/
 
 /* function used to prevent loosing the open menu when using nested pulldowns,
@@ -3474,9 +3490,11 @@ int ui_handle_menu_event(bContext *C, wmEvent *event, uiMenuBlockHandle *menu, i
                }
        }
 
-       /* if we are inside the region and didn't handle the event yet, lets
-        * pass it on to buttons inside this region */
-       if((inside && !menu->menuretval && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
+       /* if we are didn't handle the event yet, lets pass it on to
+        * buttons inside this region. disabled inside check .. not sure
+        * anymore why it was there? but i meant enter enter didn't work
+        * for example when mouse was not over submenu */
+       if((/*inside &&*/ !menu->menuretval && retval == WM_UI_HANDLER_CONTINUE) || event->type == TIMER) {
                but= ui_but_find_activated(ar);
 
                if(but)
index af14bc95207891dcb12faaeb41385770bbec39fc..34ab1c8d48f5b6b01aa47514a9fd6e3195ec7f2d 100644 (file)
@@ -365,7 +365,7 @@ static void wm_draw_triple_fail(bContext *C, wmWindow *win)
 
 static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
 {
-       GLint format;
+       GLint width;
        int x, y;
 
        /* compute texture sizes */
@@ -402,13 +402,14 @@ static int wm_triple_gen_textures(wmWindow *win, wmDrawTriple *triple)
 
        for(y=0; y<triple->ny; y++) {
                for(x=0; x<triple->nx; x++) {
+                       /* disabled, does not seems to work well everywhere */
                        /* proxy texture is only guaranteed to test for the cases that
                         * there is only one texture in use, which may not be the case */
                        glBindTexture(triple->target, triple->bind[x + y*triple->nx]);
                        glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGB8, triple->x[x], triple->y[y], 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
-                       glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_INTERNAL_FORMAT, &format);
+                       glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
 
-                       if(format == 0) {
+                       if(width == 0) {
                                glBindTexture(triple->target, 0);
                                printf("WM: failed to allocate texture for triple buffer drawing (GL_PROXY_TEXTURE_2D).\n");
                                return 0;
index f702154735e2c9e440c2748433b69c2adc1d7b09..65acef765b04e7e7563a6b0f45837c60727f3220 100644 (file)
@@ -248,6 +248,8 @@ void WM_exit(bContext *C)
 #ifdef INTERNATIONAL
        FTF_End();
 #endif
+
+       GPU_extensions_exit();
        
 //     if (copybuf) MEM_freeN(copybuf);
 //     if (copybufinfo) MEM_freeN(copybufinfo);