Commit: 30647c0d5c285985c7c91d0293aba3c7b3e442de
Author: Julian Eisel
Date:   Fri Mar 11 17:03:45 2016 +0100
Branches: HMD_viewport
https://developer.blender.org/rB30647c0d5c285985c7c91d0293aba3c7b3e442de

Custom title for HMD window ("Blender HMD View")

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

M       source/blender/windowmanager/intern/wm_event_system.c
M       source/blender/windowmanager/intern/wm_operators.c
M       source/blender/windowmanager/intern/wm_window.c
M       source/blender/windowmanager/wm_window.h

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

diff --git a/source/blender/windowmanager/intern/wm_event_system.c 
b/source/blender/windowmanager/intern/wm_event_system.c
index 09cc171..ee3fd21 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -288,10 +288,10 @@ void wm_event_do_notifiers(bContext *C)
                        if (note->category == NC_WM) {
                                if (ELEM(note->data, ND_FILEREAD, ND_FILESAVE)) 
{
                                        wm->file_saved = 1;
-                                       wm_window_title(wm, win);
+                                       wm_window_title(wm, win, NULL);
                                }
                                else if (note->data == ND_DATACHANGED)
-                                       wm_window_title(wm, win);
+                                       wm_window_title(wm, win, NULL);
                        }
                        if (note->window == win) {
                                if (note->category == NC_SCREEN) {
diff --git a/source/blender/windowmanager/intern/wm_operators.c 
b/source/blender/windowmanager/intern/wm_operators.c
index 655e4ed..b8fe153 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -5119,7 +5119,10 @@ static int wm_hmd_view_open_invoke(bContext *C, 
wmOperator *UNUSED(op), const wm
                BLI_assert(0);
                return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
        }
+
        wm->win_hmd = win;
+       wm_window_title(wm, win, "Blender HMD View");
+
        wmWindow *prevwin = CTX_wm_window(C);
        ScrArea *prevsa = CTX_wm_area(C);
        ARegion *prevar = CTX_wm_region(C);
diff --git a/source/blender/windowmanager/intern/wm_window.c 
b/source/blender/windowmanager/intern/wm_window.c
index 13148a5..fb2a8e8 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -347,15 +347,21 @@ void wm_window_close(bContext *C, wmWindowManager *wm, 
wmWindow *win)
        }               
 }
 
-void wm_window_title(wmWindowManager *wm, wmWindow *win)
+/**
+ * Set window title to \a title if it's non-NULL, else to autogenerated string.
+ */
+void wm_window_title(wmWindowManager *wm, wmWindow *win, const char *title)
 {
        if (win->screen && win->screen->temp) {
                /* nothing to do for 'temp' windows,
                 * because WM_window_open_temp always sets window title  */
        }
        else if (win->ghostwin) {
+               if (title) {
+                       GHOST_SetTitle(win->ghostwin, title);
+               }
                /* this is set to 1 if you don't have startup.blend open */
-               if (G.save_over && G.main->name[0]) {
+               else if (G.save_over && G.main->name[0]) {
                        char str[sizeof(G.main->name) + 24];
                        BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", 
wm->file_saved ? "" : "*", G.main->name,
                                     G.main->recovered ? " (Recovered)" : "");
@@ -557,7 +563,7 @@ void wm_window_ghostwindows_ensure(wmWindowManager *wm)
                        ListBase *lb = WM_dropboxmap_find("Window", 0, 0);
                        WM_event_add_dropbox_handler(&win->handlers, lb);
                }
-               wm_window_title(wm, win);
+               wm_window_title(wm, win, NULL);
        }
 }
 
diff --git a/source/blender/windowmanager/wm_window.h 
b/source/blender/windowmanager/wm_window.h
index c106f9d..a91af0e 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -47,7 +47,7 @@ wmWindow      *wm_window_copy_test    (bContext *C, wmWindow 
*win_src);
 void           wm_window_free                  (bContext *C, wmWindowManager 
*wm, wmWindow *win);
 void           wm_window_close                 (bContext *C, wmWindowManager 
*wm, wmWindow *win);
 
-void           wm_window_title                         (wmWindowManager *wm, 
wmWindow *win);
+void           wm_window_title                         (wmWindowManager *wm, 
wmWindow *win, const char *title);
 void           wm_window_ghostwindows_ensure(wmWindowManager *wm);
 void           wm_window_ghostwindows_remove_invalid(bContext *C, 
wmWindowManager *wm);
 void           wm_window_process_events        (const bContext *C);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to