diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-02-21 14:03:12 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-02-21 20:42:08 -0500 |
commit | 0065086821e17f8f0402760aac23069b8970eb39 (patch) | |
tree | e38519fe1fb5b1cf4a44c8458f4083674f62e12c | |
parent | 0c3119454c779b4ef7e96a23d454403768121c0a (diff) |
kerenlshark: Only set cursor or freeze window if parent exists
If parent_window is NULL have both set_cursor and freeze do nothing.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | trace-dialog.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/trace-dialog.c b/trace-dialog.c index 1bbbac6..d5d8c04 100644 --- a/trace-dialog.c +++ b/trace-dialog.c | |||
@@ -91,9 +91,14 @@ void trace_dialog_register_window(GtkWidget *window) | |||
91 | 91 | ||
92 | void trace_set_cursor(GdkCursorType type) | 92 | void trace_set_cursor(GdkCursorType type) |
93 | { | 93 | { |
94 | GdkWindow *window = GTK_WIDGET(parent_window)->window; | 94 | GdkWindow *window; |
95 | GdkCursor *cursor; | 95 | GdkCursor *cursor; |
96 | 96 | ||
97 | if (!parent_window) | ||
98 | return; | ||
99 | |||
100 | window = GTK_WIDGET(parent_window)->window; | ||
101 | |||
97 | if (!parent_cursor) | 102 | if (!parent_cursor) |
98 | parent_cursor = gdk_window_get_cursor(window); | 103 | parent_cursor = gdk_window_get_cursor(window); |
99 | else { | 104 | else { |
@@ -111,9 +116,13 @@ void trace_set_cursor(GdkCursorType type) | |||
111 | 116 | ||
112 | void trace_put_cursor(void) | 117 | void trace_put_cursor(void) |
113 | { | 118 | { |
114 | GdkWindow *window = GTK_WIDGET(parent_window)->window; | 119 | GdkWindow *window; |
115 | GdkCursor *cursor; | 120 | GdkCursor *cursor; |
116 | 121 | ||
122 | if (!parent_window) | ||
123 | return; | ||
124 | |||
125 | window = GTK_WIDGET(parent_window)->window; | ||
117 | cursor = gdk_window_get_cursor(window); | 126 | cursor = gdk_window_get_cursor(window); |
118 | if (cursor && cursor != parent_cursor) | 127 | if (cursor && cursor != parent_cursor) |
119 | gdk_cursor_unref(cursor); | 128 | gdk_cursor_unref(cursor); |
@@ -122,12 +131,14 @@ void trace_put_cursor(void) | |||
122 | 131 | ||
123 | void trace_freeze_all(void) | 132 | void trace_freeze_all(void) |
124 | { | 133 | { |
125 | gtk_widget_set_sensitive(GTK_WIDGET(parent_window), FALSE); | 134 | if (parent_window) |
135 | gtk_widget_set_sensitive(GTK_WIDGET(parent_window), FALSE); | ||
126 | } | 136 | } |
127 | 137 | ||
128 | void trace_unfreeze_all(void) | 138 | void trace_unfreeze_all(void) |
129 | { | 139 | { |
130 | gtk_widget_set_sensitive(GTK_WIDGET(parent_window), TRUE); | 140 | if (parent_window) |
141 | gtk_widget_set_sensitive(GTK_WIDGET(parent_window), TRUE); | ||
131 | } | 142 | } |
132 | 143 | ||
133 | /** | 144 | /** |