Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-31 04:59:17 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-31 04:59:17 +0400
commit5b88712ff932fcbcd0bb0fb257e8e9c2e247a82a (patch)
treeca0f15ee78fee5aef80ebf5c0f9f46529b65a9e2 /source/blender/windowmanager
parentebb229110e4af5d2df5613b6345da2f602b90092 (diff)
move debug flag into its own global var (G.debug), split up debug options.
--debug --debug-ffmpeg --debug-python --debug-events --debug-wm This makes debug output easier to read - event debug prints would flood output too much before. For convenience: --debug-all turns all debug flags on (works as --debug did before). also removed some redundant whitespace in debug prints and prefix some prints with __func__ to give some context.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c4
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c34
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c2
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c5
-rw-r--r--source/blender/windowmanager/intern/wm_window.c35
6 files changed, 49 insertions, 33 deletions
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index 80a25913481..f97391c0d6e 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -188,7 +188,7 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
if (hide) mode = GHOST_kGrabHide;
else if (wrap) mode = GHOST_kGrabWrap;
- if ((G.f & G_DEBUG) == 0) {
+ if ((G.debug & G_DEBUG) == 0) {
if (win && win->ghostwin) {
const GHOST_TabletData *tabletdata = GHOST_GetTabletData(win->ghostwin);
// Note: There is no tabletdata on Windows if no tablet device is connected.
@@ -204,7 +204,7 @@ void WM_cursor_grab(wmWindow *win, int wrap, int hide, int *bounds)
void WM_cursor_ungrab(wmWindow *win)
{
- if ((G.f & G_DEBUG) == 0) {
+ if ((G.debug & G_DEBUG) == 0) {
if (win && win->ghostwin) {
GHOST_SetCursorGrab(win->ghostwin, GHOST_kGrabDisable, NULL);
win->grabcursor = GHOST_kGrabDisable;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 2327ca46862..42fb03d5d64 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -213,13 +213,13 @@ void wm_event_do_notifiers(bContext *C)
if (note->category == NC_SCREEN) {
if (note->data == ND_SCREENBROWSE) {
ED_screen_set(C, note->reference); // XXX hrms, think this over!
- if (G.f & G_DEBUG)
- printf("screen set %p\n", note->reference);
+ if (G.debug & G_DEBUG_EVENTS)
+ printf("%s: screen set %p\n", __func__, note->reference);
}
else if (note->data == ND_SCREENDELETE) {
ED_screen_delete(C, note->reference); // XXX hrms, think this over!
- if (G.f & G_DEBUG)
- printf("screen delete %p\n", note->reference);
+ if (G.debug & G_DEBUG_EVENTS)
+ printf("%s: screen delete %p\n", __func__, note->reference);
}
}
}
@@ -482,7 +482,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
}
if (retval & OPERATOR_FINISHED) {
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG_WM) {
/* todo - this print may double up, might want to check more flags then the FINISHED */
wm_operator_print(C, op);
}
@@ -544,7 +544,7 @@ static void wm_operator_finished(bContext *C, wmOperator *op, int repeat)
ED_undo_push_op(C, op);
if (repeat == 0) {
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG_WM) {
char *buf = WM_operator_pystring(C, op->type, op->ptr, 1);
BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf);
MEM_freeN(buf);
@@ -754,7 +754,9 @@ int WM_operator_last_properties_init(wmOperator *op)
if (op->type->last_properties) {
PropertyRNA *iterprop;
- if (G.f & G_DEBUG) printf("%s: loading previous properties for '%s'\n", __func__, op->type->idname);
+ if (G.debug & G_DEBUG_WM) {
+ printf("%s: loading previous properties for '%s'\n", __func__, op->type->idname);
+ }
iterprop = RNA_struct_iterator_property(op->type->srna);
@@ -792,7 +794,9 @@ int WM_operator_last_properties_store(wmOperator *op)
}
if (op->properties) {
- if (G.f & G_DEBUG) printf("%s: storing properties for '%s'\n", __func__, op->type->idname);
+ if (G.debug & G_DEBUG_WM) {
+ printf("%s: storing properties for '%s'\n", __func__, op->type->idname);
+ }
op->type->last_properties = IDP_CopyProperty(op->properties);
return TRUE;
}
@@ -819,8 +823,9 @@ static int wm_operator_invoke(bContext *C, wmOperatorType *ot, wmEvent *event, P
WM_operator_last_properties_init(op);
}
- if ((G.f & G_DEBUG) && event && event->type != MOUSEMOVE)
- printf("handle evt %d win %d op %s\n", event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
+ if ((G.debug & G_DEBUG_EVENTS) && event && event->type != MOUSEMOVE) {
+ printf("%s: handle evt %d win %d op %s\n", __func__, event ? event->type : 0, CTX_wm_screen(C)->subwinactive, ot->idname);
+ }
if (op->type->invoke && event) {
wm_region_mouse_co(C, event);
@@ -1540,7 +1545,7 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
wm->op_undo_depth--;
if (retval & OPERATOR_FINISHED)
- if (G.f & G_DEBUG)
+ if (G.debug & G_DEBUG_WM)
wm_operator_print(C, handler->op);
/* XXX check this carefully, CTX_wm_manager(C) == wm is a bit hackish */
@@ -1965,9 +1970,10 @@ void wm_event_do_handlers(bContext *C)
while ( (event = win->queue.first) ) {
int action = WM_HANDLER_CONTINUE;
- if ((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
- printf("pass on evt %d val %d\n", event->type, event->val);
-
+ if ((G.debug & G_DEBUG_EVENTS) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
+ printf("%s: pass on evt %d val %d\n", __func__, event->type, event->val);
+ }
+
wm_eventemulation(event);
CTX_wm_window_set(C, win);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index a9f17359573..39651cea3ab 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -448,7 +448,7 @@ void WM_exit_ext(bContext *C, const short do_python)
#ifdef WIN32
/* ask user to press enter when in debug mode */
- if (G.f & G_DEBUG) {
+ if (G.debug & G_DEBUG) {
printf("press enter key to exit...\n\n");
getchar();
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 94de4293a6e..123cc60e4fa 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1371,7 +1371,7 @@ static void operator_search_cb(const struct bContext *C, void *UNUSED(arg), cons
for (; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot = BLI_ghashIterator_getValue(iter);
- if ((ot->flag & OPTYPE_INTERNAL) && (G.f & G_DEBUG) == 0)
+ if ((ot->flag & OPTYPE_INTERNAL) && (G.debug & G_DEBUG_WM) == 0)
continue;
if (BLI_strcasestr(ot->name, str)) {
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 564fa963d6e..6ffb28ba013 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -163,7 +163,10 @@ int wm_subwindow_open(wmWindow *win, rcti *winrct)
win->curswin = swin = MEM_callocN(sizeof(wmSubWindow), "swinopen");
BLI_addtail(&win->subwindows, swin);
- if (G.f & G_DEBUG) printf("swin %d added\n", freewinid);
+ if (G.debug & G_DEBUG_EVENTS) {
+ printf("%s: swin %d added\n", __func__, freewinid);
+ }
+
swin->swinid = freewinid;
swin->winrct = *winrct;
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index fd9d789ffd4..031cfe90042 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -625,7 +625,9 @@ void wm_window_make_drawable(bContext *C, wmWindow *win)
// win->lmbut= 0; /* keeps hanging when mousepressed while other window opened */
wm->windrawable = win;
- if (G.f & G_DEBUG) printf("set drawable %d\n", win->winid);
+ if (G.debug & G_DEBUG_EVENTS) {
+ printf("%s: set drawable %d\n", __func__, win->winid);
+ }
GHOST_ActivateWindowDrawingContext(win->ghostwin);
}
}
@@ -716,7 +718,9 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
break;
}
case GHOST_kEventWindowUpdate: {
- if (G.f & G_DEBUG) printf("ghost redraw\n");
+ if (G.debug & G_DEBUG_EVENTS) {
+ printf("%s: ghost redraw %d\n", __func__, win->winid);
+ }
wm_window_make_drawable(C, win);
WM_event_add_notifier(C, NC_WINDOW, NULL);
@@ -765,29 +769,32 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private)
win->posy = posy;
/* debug prints */
- if (0) {
+ if (G.debug & G_DEBUG_EVENTS) {
+ const char *state_str;
state = GHOST_GetWindowState(win->ghostwin);
-
+
if (state == GHOST_kWindowStateNormal) {
- if (G.f & G_DEBUG) printf("window state: normal\n");
+ state_str = "normal";
}
else if (state == GHOST_kWindowStateMinimized) {
- if (G.f & G_DEBUG) printf("window state: minimized\n");
+ state_str = "minimized";
}
else if (state == GHOST_kWindowStateMaximized) {
- if (G.f & G_DEBUG) printf("window state: maximized\n");
+ state_str = "maximized";
}
else if (state == GHOST_kWindowStateFullScreen) {
- if (G.f & G_DEBUG) printf("window state: fullscreen\n");
+ state_str = "fullscreen";
}
-
+ else {
+ state_str = "<unknown>";
+ }
+
+ printf("%s: window %d state = %s\n", __func__, win->winid, state_str);
+
if (type != GHOST_kEventWindowSize) {
- if (G.f & G_DEBUG) {
- printf("win move event pos %d %d size %d %d\n",
- win->posx, win->posy, win->sizex, win->sizey);
- }
+ printf("win move event pos %d %d size %d %d\n",
+ win->posx, win->posy, win->sizex, win->sizey);
}
-
}
wm_window_make_drawable(C, win);