81edb1e363fa21481ca7c2cf3d63c6621ffc188e
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2003-2004 Mathieu Desnoyers
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
27 #include <ltt/trace.h>
29 #include <lttv/lttv.h>
30 #include <lttv/tracecontext.h>
31 #include <lttvwindow/lttvwindow.h>
32 #include <lttv/state.h>
33 #include <lttv/hook.h>
36 #include "eventhooks.h"
39 //#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format)
40 //#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format)
43 // fixed #define TRACE_NUMBER 0
44 #define EXTRA_ALLOC 1024 // pixels
47 #if 0 /* colors for two lines representation */
48 GdkColor drawing_colors
[NUM_COLORS
] =
49 { /* Pixel, R, G, B */
50 { 0, 0, 0, 0 }, /* COL_BLACK */
51 { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_WHITE */
52 { 0, 0x0FFF, 0xFFFF, 0xFFFF }, /* COL_WAIT_FORK : pale blue */
53 { 0, 0xFFFF, 0xFFFF, 0x0000 }, /* COL_WAIT_CPU : yellow */
54 { 0, 0xFFFF, 0xA000, 0xFCFF }, /* COL_EXIT : pale magenta */
55 { 0, 0xFFFF, 0x0000, 0xFFFF }, /* COL_ZOMBIE : purple */
56 { 0, 0xFFFF, 0x0000, 0x0000 }, /* COL_WAIT : red */
57 { 0, 0x0000, 0xFFFF, 0x0000 }, /* COL_RUN : green */
58 { 0, 0x8800, 0xFFFF, 0x8A00 }, /* COL_USER_MODE : pale green */
59 { 0, 0x09FF, 0x01FF, 0xFFFF }, /* COL_SYSCALL : blue */
60 { 0, 0xF900, 0x4200, 0xFF00 }, /* COL_TRAP : pale purple */
61 { 0, 0xFFFF, 0x5AFF, 0x01FF }, /* COL_IRQ : orange */
62 { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_MODE_UNKNOWN : white */
68 GdkColor drawing_colors
[NUM_COLORS
] =
69 { /* Pixel, R, G, B */
70 { 0, 0, 0, 0 }, /* COL_BLACK */
71 { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_WHITE */
72 { 0, 0x0000, 0xFF00, 0x0000 }, /* COL_RUN_USER_MODE : green */
73 { 0, 0x0100, 0x9E00, 0xFFFF }, /* COL_RUN_SYSCALL : pale blue */
74 { 0, 0xFF00, 0xFF00, 0x0100 }, /* COL_RUN_TRAP : yellow */
75 { 0, 0xFFFF, 0x5E00, 0x0000 }, /* COL_RUN_IRQ : orange */
76 { 0, 0xFFFF, 0x9400, 0x9600 }, /* COL_RUN_SOFT_IRQ : pink */
77 { 0, 0x6600, 0x0000, 0x0000 }, /* COL_WAIT : dark red */
78 { 0, 0x7700, 0x7700, 0x0000 }, /* COL_WAIT_CPU : dark yellow */
79 { 0, 0x6400, 0x0000, 0x5D00 }, /* COL_ZOMBIE : dark purple */
80 { 0, 0x0700, 0x6400, 0x0000 }, /* COL_WAIT_FORK : dark green */
81 { 0, 0x8900, 0x0000, 0x8400 }, /* COL_EXIT : "less dark" magenta */
82 { 0, 0xFFFF, 0xFFFF, 0xFFFF }, /* COL_MODE_UNKNOWN : white */
83 { 0, 0xFFFF, 0xFFFF, 0xFFFF } /* COL_UNNAMED : white */
93 WAIT CPU + WAIT FORK vert foncé ou jaune
102 /*****************************************************************************
103 * drawing functions *
104 *****************************************************************************/
107 expose_ruler( GtkWidget
*widget
, GdkEventExpose
*event
, gpointer user_data
);
110 motion_notify_ruler(GtkWidget
*widget
, GdkEventMotion
*event
, gpointer user_data
);
113 /* Function responsible for updating the exposed area.
114 * It must do an events request to the lttvwindow API to ask for this update.
115 * Note : this function cannot clear the background, because it may
116 * erase drawing already present (SAFETY).
118 void drawing_data_request(Drawing_t
*drawing
,
123 if(width
< 0) return ;
124 if(height
< 0) return ;
127 Tab
*tab
= drawing
->control_flow_data
->tab
;
128 TimeWindow time_window
=
129 lttvwindow_get_time_window(tab
);
131 ControlFlowData
*control_flow_data
= drawing
->control_flow_data
;
132 // (ControlFlowData*)g_object_get_data(
133 // G_OBJECT(drawing->drawing_area), "control_flow_data");
135 LttTime start
, time_end
;
136 LttTime window_end
= time_window
.end_time
;
138 g_debug("req : window start_time : %lu, %lu", time_window
.start_time
.tv_sec
,
139 time_window
.start_time
.tv_nsec
);
141 g_debug("req : window time width : %lu, %lu", time_window
.time_width
.tv_sec
,
142 time_window
.time_width
.tv_nsec
);
144 g_debug("req : window_end : %lu, %lu", window_end
.tv_sec
,
147 g_debug("x is : %i, x+width is : %i", x
, x
+width
);
149 convert_pixels_to_time(drawing
->width
, x
,
153 convert_pixels_to_time(drawing
->width
, x
+width
,
156 time_end
= ltt_time_add(time_end
, ltt_time_one
); // because main window
157 // doesn't deliver end time.
159 lttvwindow_events_request_remove_all(tab
,
163 /* find the tracehooks */
164 LttvTracesetContext
*tsc
= lttvwindow_get_traceset_context(tab
);
166 LttvTraceset
*traceset
= tsc
->ts
;
168 guint i
, k
, l
, nb_trace
;
172 LttvTracefileState
*tfs
;
178 LttvTraceHookByFacility
*thf
;
181 gint before_hn
, after_hn
;
183 nb_trace
= lttv_traceset_number(traceset
);
184 // FIXME (fixed) : eventually request for more traces
185 for(i
= 0 ; i
< nb_trace
; i
++) {
186 //for(i = 0; i<MIN(TRACE_NUMBER+1, nb_trace);i++) {
187 EventsRequest
*events_request
= g_new(EventsRequest
, 1);
189 //LttvHooks *event = lttv_hooks_new();
190 LttvHooksById
*event_by_id
= lttv_hooks_by_id_new();
191 LttvHooks
*before_chunk_traceset
= lttv_hooks_new();
192 LttvHooks
*after_chunk_traceset
= lttv_hooks_new();
193 LttvHooks
*before_request_hook
= lttv_hooks_new();
194 LttvHooks
*after_request_hook
= lttv_hooks_new();
196 lttv_hooks_add(before_chunk_traceset
,
201 lttv_hooks_add(after_chunk_traceset
,
206 lttv_hooks_add(before_request_hook
,
211 lttv_hooks_add(after_request_hook
,
217 ts
= (LttvTraceState
*)tsc
->traces
[i
];
219 /* Find the eventtype id for the following events and register the
220 associated by id hooks. */
222 hooks
= g_array_new(FALSE
, FALSE
, sizeof(LttvTraceHook
));
223 hooks
= g_array_set_size(hooks
, 18);
224 before_hn
= after_hn
= 0;
228 // ret = lttv_trace_find_hook(ts->parent.t,
229 // LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_ENTRY,
230 // LTT_FIELD_SYSCALL_ID, 0, 0,
231 // before_execmode_hook,
233 // &g_array_index(hooks, LttvTraceHook, before_hn++));
234 // if(ret) before_hn--;
236 // ret = lttv_trace_find_hook(ts->parent.t,
237 // LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_SYSCALL_EXIT,
239 // before_execmode_hook,
241 // &g_array_index(hooks, LttvTraceHook, before_hn++));
242 // if(ret) before_hn--;
244 // ret = lttv_trace_find_hook(ts->parent.t,
245 // LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_ENTRY,
246 // LTT_FIELD_TRAP_ID, 0, 0,
247 // before_execmode_hook,
249 // &g_array_index(hooks, LttvTraceHook, before_hn++));
250 // if(ret) before_hn--;
252 // ret = lttv_trace_find_hook(ts->parent.t,
253 // LTT_FACILITY_KERNEL_ARCH, LTT_EVENT_TRAP_EXIT,
255 // before_execmode_hook,
257 // &g_array_index(hooks, LttvTraceHook, before_hn++));
258 // if(ret) before_hn--;
260 // ret = lttv_trace_find_hook(ts->parent.t,
261 // LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_ENTRY,
262 // LTT_FIELD_IRQ_ID, 0, 0,
263 // before_execmode_hook,
265 // &g_array_index(hooks, LttvTraceHook, before_hn++));
266 // if(ret) before_hn--;
268 // ret = lttv_trace_find_hook(ts->parent.t,
269 // LTT_FACILITY_KERNEL, LTT_EVENT_IRQ_EXIT,
271 // before_execmode_hook,
273 // &g_array_index(hooks, LttvTraceHook, before_hn++));
274 // if(ret) before_hn--;
276 // ret = lttv_trace_find_hook(ts->parent.t,
277 // LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_ENTRY,
278 // LTT_FIELD_SOFT_IRQ_ID, 0, 0,
279 // before_execmode_hook,
281 // &g_array_index(hooks, LttvTraceHook, before_hn++));
282 // if(ret) before_hn--;
284 // ret = lttv_trace_find_hook(ts->parent.t,
285 // LTT_FACILITY_KERNEL, LTT_EVENT_SOFT_IRQ_EXIT,
287 // before_execmode_hook,
289 // &g_array_index(hooks, LttvTraceHook, before_hn++));
290 // if(ret) before_hn--;
293 ret
= lttv_trace_find_hook(ts
->parent
.t
,
294 LTT_FACILITY_KERNEL
, LTT_EVENT_SCHED_SCHEDULE
,
295 LTT_FIELD_PREV_PID
, LTT_FIELD_NEXT_PID
, LTT_FIELD_PREV_STATE
,
296 before_schedchange_hook
,
298 &g_array_index(hooks
, LttvTraceHook
, before_hn
++));
301 // ret = lttv_trace_find_hook(ts->parent.t,
302 // LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
303 // LTT_FIELD_PID, 0, 0,
304 // before_process_exit_hook,
306 // &g_array_index(hooks, LttvTraceHook, before_hn++));
307 // if(ret) before_hn--;
309 // ret = lttv_trace_find_hook(ts->parent.t,
310 // LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FREE,
311 // LTT_FIELD_PID, 0, 0,
312 // before_process_release_hook,
314 // &g_array_index(hooks, LttvTraceHook, before_hn++));
315 // if(ret) before_hn--;
317 // ret = lttv_trace_find_hook(ts->parent.t,
318 // LTT_FACILITY_LIST, LTT_EVENT_STATEDUMP_END,
320 // before_statedump_end,
322 // &g_array_index(hooks, LttvTraceHook, before_hn++));
323 // if(ret) before_hn--;
326 lttv_trace_find_hook(ts
->parent
.t
,
327 "core", "process", "event_sub_id",
328 "event_data1", "event_data2", before_process_hook
,
329 &g_array_index(hooks
, LttvTraceHook
, hn
++));
332 lttv_trace_find_hook(ts
->parent
.t
, "core", "process_fork", "child_pid",
333 NULL
, NULL
, process_fork
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
335 lttv_trace_find_hook(ts
->parent
.t
, "core", "process_exit", NULL
, NULL
,
336 NULL
, process_exit
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
342 /**** DESACTIVATED ****/
343 lttv_trace_find_hook(ts
->parent
.t
, "core","syscall_entry","syscall_id",
344 NULL
, NULL
, after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
345 /**** DESACTIVATED ****/
346 lttv_trace_find_hook(ts
->parent
.t
, "core", "syscall_exit", NULL
, NULL
,
347 NULL
, after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
349 /**** DESACTIVATED ****/
350 lttv_trace_find_hook(ts
->parent
.t
, "core", "trap_entry", "trap_id",
351 NULL
, NULL
, after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
353 /**** DESACTIVATED ****/
354 lttv_trace_find_hook(ts
->parent
.t
, "core", "trap_exit", NULL
, NULL
, NULL
,
355 after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
357 /**** DESACTIVATED ****/
358 lttv_trace_find_hook(ts
->parent
.t
, "core", "irq_entry", "irq_id", NULL
,
359 NULL
, after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
361 /**** DESACTIVATED ****/
362 lttv_trace_find_hook(ts
->parent
.t
, "core", "irq_exit", NULL
, NULL
, NULL
,
363 after_execmode_hook
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
366 lttv_trace_find_hook(ts
->parent
.t
, "core", "schedchange", "in", "out",
367 "out_state", after_schedchange_hook
,
368 &g_array_index(hooks
, LttvTraceHook
, hn
++));
370 lttv_trace_find_hook(ts
->parent
.t
, "core", "process", "event_sub_id",
371 "event_data1", "event_data2", after_process_hook
,
372 &g_array_index(hooks
, LttvTraceHook
, hn
++));
374 after_hn
= before_hn
;
376 ret
= lttv_trace_find_hook(ts
->parent
.t
,
377 LTT_FACILITY_KERNEL
, LTT_EVENT_SCHED_SCHEDULE
,
378 LTT_FIELD_PREV_PID
, LTT_FIELD_NEXT_PID
, LTT_FIELD_PREV_STATE
,
379 after_schedchange_hook
,
381 &g_array_index(hooks
, LttvTraceHook
, after_hn
++));
384 // ret = lttv_trace_find_hook(ts->parent.t,
385 // LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_FORK,
386 // LTT_FIELD_PARENT_PID, LTT_FIELD_CHILD_PID, 0,
387 // after_process_fork_hook,
389 // &g_array_index(hooks, LttvTraceHook, after_hn++));
390 // if(ret) after_hn--;
392 // ret = lttv_trace_find_hook(ts->parent.t,
393 // LTT_FACILITY_KERNEL, LTT_EVENT_PROCESS_EXIT,
394 // LTT_FIELD_PID, 0, 0,
395 // after_process_exit_hook,
397 // &g_array_index(hooks, LttvTraceHook, after_hn++));
398 // if(ret) after_hn--;
400 // ret = lttv_trace_find_hook(ts->parent.t,
401 // LTT_FACILITY_FS, LTT_EVENT_EXEC,
403 // after_fs_exec_hook,
405 // &g_array_index(hooks, LttvTraceHook, after_hn++));
406 // if(ret) after_hn--;
408 // ret = lttv_trace_find_hook(ts->parent.t,
409 // LTT_FACILITY_USER_GENERIC, LTT_EVENT_THREAD_BRAND,
410 // LTT_FIELD_NAME, 0, 0,
411 // after_user_generic_thread_brand_hook,
413 // &g_array_index(hooks, LttvTraceHook, after_hn++));
414 // if(ret) after_hn--;
416 // ret = lttv_trace_find_hook(ts->parent.t,
417 // LTT_FACILITY_LIST, LTT_EVENT_PROCESS_STATE,
418 // LTT_FIELD_PID, LTT_FIELD_PARENT_PID, LTT_FIELD_NAME,
419 // after_event_enum_process_hook,
421 // &g_array_index(hooks, LttvTraceHook, after_hn++));
422 // if(ret) after_hn--;
424 hooks
= g_array_set_size(hooks
, after_hn
);
427 lttv_trace_find_hook(ts
->parent
.t
, "core", "process_fork", "child_pid",
428 NULL
, NULL
, process_fork
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
430 lttv_trace_find_hook(ts
->parent
.t
, "core", "process_exit", NULL
, NULL
,
431 NULL
, process_exit
, &g_array_index(hooks
, LttvTraceHook
, hn
++));
436 /* Add these hooks to each event_by_id hooks list */
438 for(k
= 0 ; k
< before_hn
; k
++) {
439 hook
= &g_array_index(hooks
, LttvTraceHook
, k
);
440 for(l
=0;l
<hook
->fac_list
->len
;l
++) {
441 thf
= g_array_index(hook
->fac_list
, LttvTraceHookByFacility
*, l
);
442 lttv_hooks_add(lttv_hooks_by_id_find(event_by_id
, thf
->id
),
450 for(k
= before_hn
; k
< after_hn
; k
++) {
451 hook
= &g_array_index(hooks
, LttvTraceHook
, k
);
452 for(l
=0;l
<hook
->fac_list
->len
;l
++) {
453 thf
= g_array_index(hook
->fac_list
, LttvTraceHookByFacility
*, l
);
454 lttv_hooks_add(lttv_hooks_by_id_find(event_by_id
, thf
->id
),
461 events_request
->hooks
= hooks
;
463 // Fill the events request
464 events_request
->owner
= control_flow_data
;
465 events_request
->viewer_data
= control_flow_data
;
466 events_request
->servicing
= FALSE
;
467 events_request
->start_time
= start
;
468 events_request
->start_position
= NULL
;
469 events_request
->stop_flag
= FALSE
;
470 events_request
->end_time
= time_end
;
471 events_request
->num_events
= G_MAXUINT
;
472 events_request
->end_position
= NULL
;
473 events_request
->trace
= i
; //fixed /* FIXME */
474 events_request
->before_chunk_traceset
= before_chunk_traceset
;
475 events_request
->before_chunk_trace
= NULL
;
476 events_request
->before_chunk_tracefile
= NULL
;
477 events_request
->event
= NULL
;
478 events_request
->event_by_id
= event_by_id
;
479 events_request
->after_chunk_tracefile
= NULL
;
480 events_request
->after_chunk_trace
= NULL
;
481 events_request
->after_chunk_traceset
= after_chunk_traceset
;
482 events_request
->before_request
= before_request_hook
;
483 events_request
->after_request
= after_request_hook
;
485 g_debug("req : start : %lu, %lu", start
.tv_sec
,
488 g_debug("req : end : %lu, %lu", time_end
.tv_sec
,
491 lttvwindow_events_request(tab
, events_request
);
498 lttv_hooks_add(event
,
499 before_schedchange_hook
,
502 lttv_hooks_add(event
,
503 after_schedchange_hook
,
506 lttv_hooks_add(event
,
507 before_execmode_hook
,
510 lttv_hooks_add(event
,
514 lttv_hooks_add(event
,
518 lttv_hooks_add(event
,
527 static void set_last_start(gpointer key
, gpointer value
, gpointer user_data
)
529 ResourceInfo
*process_info
= (ResourceInfo
*)key
;
530 HashedResourceData
*hashed_process_data
= (HashedResourceData
*)value
;
531 guint x
= (guint
)user_data
;
533 hashed_process_data
->x
.over
= x
;
534 hashed_process_data
->x
.over_used
= FALSE
;
535 hashed_process_data
->x
.over_marked
= FALSE
;
536 hashed_process_data
->x
.middle
= x
;
537 hashed_process_data
->x
.middle_used
= FALSE
;
538 hashed_process_data
->x
.middle_marked
= FALSE
;
539 hashed_process_data
->x
.under
= x
;
540 hashed_process_data
->x
.under_used
= FALSE
;
541 hashed_process_data
->x
.under_marked
= FALSE
;
542 hashed_process_data
->next_good_time
= ltt_time_zero
;
547 void drawing_data_request_begin(EventsRequest
*events_request
, LttvTracesetState
*tss
)
549 g_debug("Begin of data request");
550 ControlFlowData
*cfd
= events_request
->viewer_data
;
551 LttvTracesetContext
*tsc
= LTTV_TRACESET_CONTEXT(tss
);
552 TimeWindow time_window
=
553 lttvwindow_get_time_window(cfd
->tab
);
555 guint width
= cfd
->drawing
->width
;
558 cfd
->drawing
->last_start
= events_request
->start_time
;
560 convert_time_to_pixels(
562 events_request
->start_time
,
566 g_hash_table_foreach(cfd
->process_list
->process_hash
, set_last_start
,
571 void drawing_chunk_begin(EventsRequest
*events_request
, LttvTracesetState
*tss
)
573 g_debug("Begin of chunk");
574 ControlFlowData
*cfd
= events_request
->viewer_data
;
575 LttvTracesetContext
*tsc
= &tss
->parent
.parent
;
576 //LttTime current_time = lttv_traceset_context_get_current_tfc(tsc)->timestamp;
578 LttvTraceset
*traceset
= tsc
->ts
;
579 guint nb_trace
= lttv_traceset_number(traceset
);
581 if(!cfd
->process_list
->current_hash_data
) {
582 cfd
->process_list
->current_hash_data
= g_new(HashedResourceData
**,nb_trace
);
583 for(i
= 0 ; i
< nb_trace
; i
++) {
584 guint num_cpu
= ltt_trace_get_num_cpu(tss
->parent
.traces
[i
]->t
);
585 cfd
->process_list
->current_hash_data
[i
] = g_new(HashedResourceData
*,num_cpu
);
586 memset(cfd
->process_list
->current_hash_data
[i
], 0,
587 sizeof(HashedResourceData
*)*num_cpu
);
590 //cfd->drawing->last_start = LTT_TIME_MIN(current_time,
591 // events_request->end_time);
595 void drawing_request_expose(EventsRequest
*events_request
,
596 LttvTracesetState
*tss
,
602 ControlFlowData
*cfd
= events_request
->viewer_data
;
603 LttvTracesetContext
*tsc
= (LttvTracesetContext
*)tss
;
604 Drawing_t
*drawing
= cfd
->drawing
;
606 TimeWindow time_window
=
607 lttvwindow_get_time_window(cfd
->tab
);
609 g_debug("request expose");
611 convert_time_to_pixels(
616 x
= drawing
->damage_begin
;
620 drawing
->damage_begin
= x
+width
;
623 gtk_widget_queue_draw_area ( drawing
->drawing_area
,
625 width
, drawing
->drawing_area
->allocation
.height
);
627 /* Update directly when scrolling */
628 gdk_window_process_updates(drawing
->drawing_area
->window
,
636 /* Create a new backing pixmap of the appropriate size */
637 /* As the scaling will always change, it's of no use to copy old
640 * Only change the size if width changes. The height is specified and changed
641 * when process ID are added or removed from the process list.
644 configure_event( GtkWidget
*widget
, GdkEventConfigure
*event
,
647 Drawing_t
*drawing
= (Drawing_t
*)user_data
;
650 /* First, get the new time interval of the main window */
651 /* we assume (see documentation) that the main window
652 * has updated the time interval before this configure gets
655 //lttvwindow_get_time_window(drawing->control_flow_data->mw,
656 // &drawing->control_flow_data->time_window);
658 /* New pixmap, size of the configure event */
659 //GdkPixmap *pixmap = gdk_pixmap_new(widget->window,
660 // widget->allocation.width + SAFETY,
661 // widget->allocation.height + SAFETY,
664 if(widget
->allocation
.width
!= drawing
->width
) {
665 g_debug("drawing configure event");
666 g_debug("New alloc draw size : %i by %i",widget
->allocation
.width
,
667 widget
->allocation
.height
);
669 drawing
->width
= widget
->allocation
.width
;
671 if(drawing
->alloc_width
< widget
->allocation
.width
) {
672 //if(drawing->pixmap)
673 // gdk_pixmap_unref(drawing->pixmap);
675 //drawing->pixmap = gdk_pixmap_new(widget->window,
676 // drawing->width + SAFETY + EXTRA_ALLOC,
677 // drawing->height + EXTRA_ALLOC,
679 drawing
->alloc_width
= drawing
->width
+ SAFETY
+ EXTRA_ALLOC
;
680 drawing
->alloc_height
= drawing
->height
+ EXTRA_ALLOC
;
681 update_pixmap_size(drawing
->control_flow_data
->process_list
,
682 drawing
->alloc_width
);
683 update_index_to_pixmap(drawing
->control_flow_data
->process_list
);
685 //drawing->height = widget->allocation.height;
687 //ProcessList_get_height
688 // (GuiControlFlow_get_process_list(drawing->control_flow_data)),
692 //gdk_draw_rectangle (drawing->pixmap,
693 // widget->style->black_gc,
696 // drawing->width+SAFETY,
699 //g_info("init data request");
702 /* Initial data request */
703 /* no, do initial data request in the expose event */
704 // Do not need to ask for data of 1 pixel : not synchronized with
705 // main window time at this moment.
706 //drawing_data_request(drawing, &drawing->pixmap, 0, 0,
707 // widget->allocation.width,
708 // widget->allocation.height);
710 //drawing->width = widget->allocation.width;
711 //drawing->height = widget->allocation.height;
713 drawing
->damage_begin
= 0;
714 drawing
->damage_end
= widget
->allocation
.width
;
716 if((widget
->allocation
.width
!= 1 &&
717 widget
->allocation
.height
!= 1)
718 && drawing
->damage_begin
< drawing
->damage_end
)
721 rectangle_pixmap (drawing
->control_flow_data
->process_list
,
722 drawing
->drawing_area
->style
->black_gc
,
725 drawing
->alloc_width
, // do not overlap
729 drawing_data_request(drawing
,
730 drawing
->damage_begin
,
732 drawing
->damage_end
- drawing
->damage_begin
,
740 /* Redraw the screen from the backing pixmap */
742 expose_event( GtkWidget
*widget
, GdkEventExpose
*event
, gpointer user_data
)
744 Drawing_t
*drawing
= (Drawing_t
*)user_data
;
746 ControlFlowData
*control_flow_data
=
747 (ControlFlowData
*)g_object_get_data(
749 "control_flow_data");
751 if(unlikely(drawing
->gc
== NULL
)) {
752 drawing
->gc
= gdk_gc_new(drawing
->drawing_area
->window
);
753 gdk_gc_copy(drawing
->gc
, drawing
->drawing_area
->style
->black_gc
);
756 TimeWindow time_window
=
757 lttvwindow_get_time_window(control_flow_data
->tab
);
758 LttTime current_time
=
759 lttvwindow_get_current_time(control_flow_data
->tab
);
763 LttTime window_end
= time_window
.end_time
;
765 /* update the screen from the pixmap buffer */
767 gdk_draw_pixmap(widget
->window
,
768 widget
->style
->fg_gc
[GTK_WIDGET_STATE (widget
)],
770 event
->area
.x
, event
->area
.y
,
771 event
->area
.x
, event
->area
.y
,
772 event
->area
.width
, event
->area
.height
);
774 drawing
->height
= processlist_get_height(control_flow_data
->process_list
);
776 copy_pixmap_to_screen(control_flow_data
->process_list
,
778 widget
->style
->fg_gc
[GTK_WIDGET_STATE (widget
)],
779 event
->area
.x
, event
->area
.y
,
780 event
->area
.width
, event
->area
.height
);
782 copy_pixmap_to_screen(control_flow_data
->process_list
,
785 event
->area
.x
, event
->area
.y
,
786 event
->area
.width
, event
->area
.height
);
789 /* Erase the dotted lines left.. */
790 if(widget
->allocation
.height
> drawing
->height
)
792 gdk_draw_rectangle (widget
->window
,
793 drawing
->drawing_area
->style
->black_gc
,
795 event
->area
.x
, drawing
->height
,
796 event
->area
.width
, // do not overlap
797 widget
->allocation
.height
- drawing
->height
);
799 if(ltt_time_compare(time_window
.start_time
, current_time
) <= 0 &&
800 ltt_time_compare(window_end
, current_time
) >= 0)
802 /* Draw the dotted lines */
803 convert_time_to_pixels(
810 if(drawing
->dotted_gc
== NULL
) {
812 drawing
->dotted_gc
= gdk_gc_new(drawing
->drawing_area
->window
);
813 gdk_gc_copy(drawing
->dotted_gc
, widget
->style
->white_gc
);
815 gint8 dash_list
[] = { 1, 2 };
816 gdk_gc_set_line_attributes(drawing
->dotted_gc
,
818 GDK_LINE_ON_OFF_DASH
,
821 gdk_gc_set_dashes(drawing
->dotted_gc
,
827 gint height_tot
= MAX(widget
->allocation
.height
, drawing
->height
);
828 gdk_draw_line(widget
->window
,
831 cursor_x
, height_tot
);
837 after_expose_event( GtkWidget
*widget
, GdkEventExpose
*event
, gpointer user_data
)
840 g_debug("AFTER EXPOSE");
849 tree_row_activated(GtkTreeModel
*treemodel
,
851 GtkTreeViewColumn
*arg2
,
854 ControlFlowData
*cfd
= (ControlFlowData
*)user_data
;
855 Drawing_t
*drawing
= cfd
->drawing
;
856 GtkTreeView
*treeview
= cfd
->process_list
->process_list_widget
;
860 path_indices
= gtk_tree_path_get_indices (arg1
);
862 height
= get_cell_height(cfd
->process_list
,
863 GTK_TREE_VIEW(treeview
));
864 drawing
->horizontal_sel
= height
* path_indices
[0];
865 g_critical("new hor sel : %i", drawing
->horizontal_sel
);
871 button_press_event( GtkWidget
*widget
, GdkEventButton
*event
, gpointer user_data
)
873 ControlFlowData
*control_flow_data
=
874 (ControlFlowData
*)g_object_get_data(
876 "control_flow_data");
877 Drawing_t
*drawing
= control_flow_data
->drawing
;
878 TimeWindow time_window
=
879 lttvwindow_get_time_window(control_flow_data
->tab
);
882 if(event
->button
== 1)
886 /* left mouse button click */
887 g_debug("x click is : %f", event
->x
);
889 convert_pixels_to_time(drawing
->width
, (guint
)event
->x
,
893 lttvwindow_report_current_time(control_flow_data
->tab
, time
);
901 scrollbar_size_allocate(GtkWidget
*widget
,
902 GtkAllocation
*allocation
,
905 Drawing_t
*drawing
= (Drawing_t
*)user_data
;
907 gtk_widget_set_size_request(drawing
->padding
, allocation
->width
, -1);
908 //gtk_widget_queue_resize(drawing->padding);
909 //gtk_widget_queue_resize(drawing->ruler);
910 gtk_container_check_resize(GTK_CONTAINER(drawing
->ruler_hbox
));
916 Drawing_t
*drawing_construct(ControlFlowData
*control_flow_data
)
918 Drawing_t
*drawing
= g_new(Drawing_t
, 1);
920 drawing
->control_flow_data
= control_flow_data
;
922 drawing
->vbox
= gtk_vbox_new(FALSE
, 1);
925 drawing
->ruler_hbox
= gtk_hbox_new(FALSE
, 1);
926 drawing
->ruler
= gtk_drawing_area_new ();
927 //gtk_widget_set_size_request(drawing->ruler, -1, 27);
929 drawing
->padding
= gtk_drawing_area_new ();
930 //gtk_widget_set_size_request(drawing->padding, -1, 27);
931 gtk_box_pack_start(GTK_BOX(drawing
->ruler_hbox
), drawing
->ruler
,
933 gtk_box_pack_end(GTK_BOX(drawing
->ruler_hbox
), drawing
->padding
,
938 drawing
->drawing_area
= gtk_drawing_area_new ();
942 drawing
->hbox
= gtk_hbox_new(FALSE
, 1);
943 drawing
->viewport
= gtk_viewport_new(NULL
, control_flow_data
->v_adjust
);
944 drawing
->scrollbar
= gtk_vscrollbar_new(control_flow_data
->v_adjust
);
945 gtk_box_pack_start(GTK_BOX(drawing
->hbox
), drawing
->viewport
,
947 gtk_box_pack_end(GTK_BOX(drawing
->hbox
), drawing
->scrollbar
,
950 //drawing->scrolled_window =
951 // gtk_scrolled_window_new (NULL,
952 // control_flow_data->v_adjust);
954 //gtk_scrolled_window_set_policy(
955 // GTK_SCROLLED_WINDOW(drawing->scrolled_window),
957 // GTK_POLICY_AUTOMATIC);
959 gtk_container_add(GTK_CONTAINER(drawing
->viewport
),
960 drawing
->drawing_area
);
961 //gtk_scrolled_window_add_with_viewport(
962 // GTK_SCROLLED_WINDOW(drawing->scrolled_window),
963 // drawing->drawing_area);
965 gtk_box_pack_start(GTK_BOX(drawing
->vbox
), drawing
->ruler_hbox
,
967 gtk_box_pack_end(GTK_BOX(drawing
->vbox
), drawing
->hbox
,
970 drawing
->pango_layout
=
971 gtk_widget_create_pango_layout(drawing
->drawing_area
, NULL
);
976 drawing
->alloc_height
= 1;
977 drawing
->alloc_width
= 1;
979 drawing
->damage_begin
= 0;
980 drawing
->damage_end
= 0;
981 drawing
->horizontal_sel
= -1;
983 //gtk_widget_set_size_request(drawing->drawing_area->window, 50, 50);
984 g_object_set_data_full(
985 G_OBJECT(drawing
->drawing_area
),
988 (GDestroyNotify
)drawing_destroy
);
991 G_OBJECT(drawing
->ruler
),
996 //gtk_widget_modify_bg( drawing->drawing_area,
998 // &CF_Colors[BLACK]);
1000 //gdk_window_get_geometry(drawing->drawing_area->window,
1002 // &(drawing->width),
1003 // &(drawing->height),
1006 //drawing->pixmap = gdk_pixmap_new(
1007 // drawing->drawing_area->window,
1012 //drawing->pixmap = NULL;
1014 // drawing->pixmap = gdk_pixmap_new(drawing->drawing_area->window,
1015 // drawing->drawing_area->allocation.width,
1016 // drawing->drawing_area->allocation.height,
1019 g_signal_connect (G_OBJECT(drawing
->drawing_area
),
1021 G_CALLBACK (configure_event
),
1024 g_signal_connect (G_OBJECT(drawing
->ruler
),
1026 G_CALLBACK(expose_ruler
),
1029 gtk_widget_add_events(drawing
->ruler
, GDK_POINTER_MOTION_MASK
);
1031 g_signal_connect (G_OBJECT(drawing
->ruler
),
1032 "motion-notify-event",
1033 G_CALLBACK(motion_notify_ruler
),
1037 g_signal_connect (G_OBJECT(drawing
->scrollbar
),
1039 G_CALLBACK(scrollbar_size_allocate
),
1044 g_signal_connect (G_OBJECT(drawing
->drawing_area
),
1046 G_CALLBACK (expose_event
),
1049 g_signal_connect_after (G_OBJECT(drawing
->drawing_area
),
1051 G_CALLBACK (after_expose_event
),
1054 g_signal_connect (G_OBJECT(drawing
->drawing_area
),
1055 "button-press-event",
1056 G_CALLBACK (button_press_event
),
1060 gtk_widget_show(drawing
->ruler
);
1061 gtk_widget_show(drawing
->padding
);
1062 gtk_widget_show(drawing
->ruler_hbox
);
1064 gtk_widget_show(drawing
->drawing_area
);
1065 //gtk_widget_show(drawing->scrolled_window);
1066 gtk_widget_show(drawing
->viewport
);
1067 gtk_widget_show(drawing
->scrollbar
);
1068 gtk_widget_show(drawing
->hbox
);
1070 /* Allocate the colors */
1071 GdkColormap
* colormap
= gdk_colormap_get_system();
1072 gboolean success
[NUM_COLORS
];
1073 gdk_colormap_alloc_colors(colormap
, drawing_colors
, NUM_COLORS
, FALSE
,
1077 gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data
->tab
)->window
));
1078 drawing
->dotted_gc
=
1079 gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data
->tab
)->window
));
1081 gdk_gc_copy(drawing
->gc
,
1082 main_window_get_widget(control_flow_data
->tab
)->style
->black_gc
);
1083 gdk_gc_copy(drawing
->dotted_gc
,
1084 main_window_get_widget(control_flow_data
->tab
)->style
->white_gc
);
1086 gint8 dash_list
[] = { 1, 2 };
1087 gdk_gc_set_line_attributes(drawing
->dotted_gc
,
1089 GDK_LINE_ON_OFF_DASH
,
1092 gdk_gc_set_dashes(drawing
->dotted_gc
,
1097 drawing
->ruler_gc_butt
=
1098 gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data
->tab
)->window
));
1099 gdk_gc_copy(drawing
->ruler_gc_butt
,
1100 main_window_get_widget(control_flow_data
->tab
)->style
->black_gc
);
1101 drawing
->ruler_gc_round
=
1102 gdk_gc_new(GDK_DRAWABLE(main_window_get_widget(control_flow_data
->tab
)->window
));
1103 gdk_gc_copy(drawing
->ruler_gc_round
,
1104 main_window_get_widget(control_flow_data
->tab
)->style
->black_gc
);
1107 gdk_gc_set_line_attributes(drawing
->ruler_gc_butt
,
1113 gdk_gc_set_line_attributes(drawing
->ruler_gc_round
,
1123 void drawing_destroy(Drawing_t
*drawing
)
1125 g_info("drawing_destroy %p", drawing
);
1127 /* Free the colors */
1128 GdkColormap
* colormap
= gdk_colormap_get_system();
1130 gdk_colormap_free_colors(colormap
, drawing_colors
, NUM_COLORS
);
1134 // Do not unref here, Drawing_t destroyed by it's widget.
1135 //g_object_unref( G_OBJECT(drawing->drawing_area));
1136 if(drawing
->gc
!= NULL
)
1137 gdk_gc_unref(drawing
->gc
);
1139 g_object_unref(drawing
->pango_layout
);
1140 if(drawing
->dotted_gc
!= NULL
) gdk_gc_unref(drawing
->dotted_gc
);
1141 if(drawing
->ruler_gc_butt
!= NULL
) gdk_gc_unref(drawing
->ruler_gc_butt
);
1142 if(drawing
->ruler_gc_round
!= NULL
) gdk_gc_unref(drawing
->ruler_gc_round
);
1145 g_info("drawing_destroy end");
1148 GtkWidget
*drawing_get_drawing_area(Drawing_t
*drawing
)
1150 return drawing
->drawing_area
;
1153 GtkWidget
*drawing_get_widget(Drawing_t
*drawing
)
1155 return drawing
->vbox
;
1158 void drawing_draw_line( Drawing_t
*drawing
,
1164 gdk_draw_line (pixmap
,
1169 void drawing_clear(Drawing_t
*drawing
)
1171 //if (drawing->pixmap)
1172 // gdk_pixmap_unref(drawing->pixmap);
1173 ControlFlowData
*cfd
= drawing
->control_flow_data
;
1176 rectangle_pixmap(cfd
->process_list
,
1177 drawing
->drawing_area
->style
->black_gc
,
1180 drawing
->alloc_width
, // do not overlap
1183 //drawing->height = 1;
1184 /* Allocate a new pixmap with new height */
1185 //drawing->pixmap = gdk_pixmap_new(drawing->drawing_area->window,
1186 // drawing->width + SAFETY + EXTRA_ALLOC,
1187 // drawing->height + EXTRA_ALLOC,
1189 //drawing->alloc_width = drawing->width + SAFETY + EXTRA_ALLOC;
1190 //drawing->alloc_height = drawing->height + EXTRA_ALLOC;
1192 //gtk_widget_set_size_request(drawing->drawing_area,
1194 // drawing->height);
1195 //gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
1197 /* ask for the buffer to be redrawn */
1198 gtk_widget_queue_draw ( drawing
->drawing_area
);
1202 /* Insert a square corresponding to a new process in the list */
1203 /* Applies to whole drawing->width */
1204 void drawing_insert_square(Drawing_t
*drawing
,
1208 //GdkRectangle update_rect;
1209 gboolean reallocate
= FALSE
;
1210 GdkPixmap
*new_pixmap
;
1212 /* Allocate a new pixmap with new height */
1213 if(drawing
->alloc_height
< drawing
->height
+ height
) {
1215 new_pixmap
= gdk_pixmap_new(drawing
->drawing_area
->window
,
1216 drawing
->width
+ SAFETY
+ EXTRA_ALLOC
,
1217 drawing
->height
+ height
+ EXTRA_ALLOC
,
1219 drawing
->alloc_width
= drawing
->width
+ SAFETY
+ EXTRA_ALLOC
;
1220 drawing
->alloc_height
= drawing
->height
+ height
+ EXTRA_ALLOC
;
1223 /* Copy the high region */
1224 gdk_draw_pixmap (new_pixmap
,
1225 drawing
->drawing_area
->style
->black_gc
,
1229 drawing
->width
+ SAFETY
, y
);
1232 new_pixmap
= drawing
->pixmap
;
1235 //GdkPixmap *pixmap = gdk_pixmap_new(drawing->drawing_area->window,
1236 // drawing->width + SAFETY,
1237 // drawing->height + height,
1240 /* add an empty square */
1241 gdk_draw_rectangle (new_pixmap
,
1242 drawing
->drawing_area
->style
->black_gc
,
1245 drawing
->width
+ SAFETY
, // do not overlap
1248 /* copy the bottom of the region */
1249 gdk_draw_pixmap (new_pixmap
,
1250 drawing
->drawing_area
->style
->black_gc
,
1254 drawing
->width
+SAFETY
, drawing
->height
- y
);
1257 if(reallocate
&& likely(drawing
->pixmap
)) {
1258 gdk_pixmap_unref(drawing
->pixmap
);
1259 drawing
->pixmap
= new_pixmap
;
1262 if(unlikely(drawing
->height
==1)) drawing
->height
= height
;
1263 else drawing
->height
+= height
;
1265 gtk_widget_set_size_request(drawing
->drawing_area
,
1268 gtk_widget_queue_resize_no_redraw(drawing
->drawing_area
);
1270 /* ask for the buffer to be redrawn */
1271 gtk_widget_queue_draw_area ( drawing
->drawing_area
,
1273 drawing
->width
, drawing
->height
-y
);
1277 /* Remove a square corresponding to a removed process in the list */
1278 void drawing_remove_square(Drawing_t
*drawing
,
1284 if(unlikely((guint
)drawing
->height
== height
)) {
1285 //pixmap = gdk_pixmap_new(
1286 // drawing->drawing_area->window,
1287 // drawing->width + SAFETY,
1290 pixmap
= drawing
->pixmap
;
1293 /* Allocate a new pixmap with new height */
1294 //pixmap = gdk_pixmap_new(
1295 // drawing->drawing_area->window,
1296 // drawing->width + SAFETY,
1297 // drawing->height - height,
1299 /* Keep the same preallocated pixmap */
1300 pixmap
= drawing
->pixmap
;
1302 /* Copy the high region */
1303 gdk_draw_pixmap (pixmap
,
1304 drawing
->drawing_area
->style
->black_gc
,
1308 drawing
->width
+ SAFETY
, y
);
1310 /* Copy up the bottom of the region */
1311 gdk_draw_pixmap (pixmap
,
1312 drawing
->drawing_area
->style
->black_gc
,
1316 drawing
->width
, drawing
->height
- y
- height
);
1318 drawing
->height
-=height
;
1321 //if(likely(drawing->pixmap))
1322 // gdk_pixmap_unref(drawing->pixmap);
1324 //drawing->pixmap = pixmap;
1326 gtk_widget_set_size_request(drawing
->drawing_area
,
1329 gtk_widget_queue_resize_no_redraw(drawing
->drawing_area
);
1330 /* ask for the buffer to be redrawn */
1331 gtk_widget_queue_draw_area ( drawing
->drawing_area
,
1333 drawing
->width
, MAX(drawing
->height
-y
, 1));
1337 void drawing_update_ruler(Drawing_t
*drawing
, TimeWindow
*time_window
)
1342 req
.width
= drawing
->ruler
->allocation
.width
;
1343 req
.height
= drawing
->ruler
->allocation
.height
;
1348 rect
.width
= req
.width
;
1349 rect
.height
= req
.height
;
1351 gtk_widget_queue_draw(drawing
->ruler
);
1352 //gtk_widget_draw( drawing->ruler, &rect);
1355 /* Redraw the ruler */
1357 expose_ruler( GtkWidget
*widget
, GdkEventExpose
*event
, gpointer user_data
)
1359 Drawing_t
*drawing
= (Drawing_t
*)user_data
;
1360 TimeWindow time_window
= lttvwindow_get_time_window(drawing
->control_flow_data
->tab
);
1363 PangoContext
*context
;
1364 PangoLayout
*layout
;
1365 PangoFontDescription
*FontDesc
;
1366 PangoRectangle ink_rect
;
1367 gint global_width
=0;
1368 GdkColor foreground
= { 0, 0, 0, 0 };
1369 GdkColor background
= { 0, 0xffff, 0xffff, 0xffff };
1371 LttTime window_end
= time_window
.end_time
;
1372 LttTime half_width
=
1373 ltt_time_div(time_window
.time_width
,2.0);
1374 LttTime window_middle
=
1375 ltt_time_add(half_width
,
1376 time_window
.start_time
);
1377 g_debug("ruler expose event");
1379 gdk_draw_rectangle (drawing
->ruler
->window
,
1380 drawing
->ruler
->style
->white_gc
,
1382 event
->area
.x
, event
->area
.y
,
1384 event
->area
.height
);
1386 gdk_draw_line (drawing
->ruler
->window
,
1387 drawing
->ruler_gc_butt
,
1389 event
->area
.x
+ event
->area
.width
, 1);
1392 snprintf(text
, 255, "%lus\n%luns",
1393 time_window
.start_time
.tv_sec
,
1394 time_window
.start_time
.tv_nsec
);
1396 layout
= gtk_widget_create_pango_layout(drawing
->drawing_area
, NULL
);
1398 context
= pango_layout_get_context(layout
);
1399 FontDesc
= pango_context_get_font_description(context
);
1401 pango_font_description_set_size(FontDesc
, 6*PANGO_SCALE
);
1402 pango_layout_context_changed(layout
);
1404 pango_layout_set_text(layout
, text
, -1);
1405 pango_layout_get_pixel_extents(layout
, &ink_rect
, NULL
);
1406 global_width
+= ink_rect
.width
;
1408 gdk_draw_layout_with_colors(drawing
->ruler
->window
,
1409 drawing
->ruler_gc_butt
,
1412 layout
, &foreground
, &background
);
1414 gdk_draw_line (drawing
->ruler
->window
,
1415 drawing
->ruler_gc_round
,
1420 snprintf(text
, 255, "%lus\n%luns", window_end
.tv_sec
,
1421 window_end
.tv_nsec
);
1423 pango_layout_set_text(layout
, text
, -1);
1424 pango_layout_get_pixel_extents(layout
, &ink_rect
, NULL
);
1425 global_width
+= ink_rect
.width
;
1427 if(global_width
<= drawing
->ruler
->allocation
.width
)
1429 gdk_draw_layout_with_colors(drawing
->ruler
->window
,
1430 drawing
->ruler_gc_butt
,
1431 drawing
->ruler
->allocation
.width
- ink_rect
.width
,
1433 layout
, &foreground
, &background
);
1435 gdk_draw_line (drawing
->ruler
->window
,
1436 drawing
->ruler_gc_butt
,
1437 drawing
->ruler
->allocation
.width
-1, 1,
1438 drawing
->ruler
->allocation
.width
-1, 7);
1442 snprintf(text
, 255, "%lus\n%luns", window_middle
.tv_sec
,
1443 window_middle
.tv_nsec
);
1445 pango_layout_set_text(layout
, text
, -1);
1446 pango_layout_get_pixel_extents(layout
, &ink_rect
, NULL
);
1447 global_width
+= ink_rect
.width
;
1449 if(global_width
<= drawing
->ruler
->allocation
.width
)
1451 gdk_draw_layout_with_colors(drawing
->ruler
->window
,
1452 drawing
->ruler_gc_butt
,
1453 (drawing
->ruler
->allocation
.width
- ink_rect
.width
)/2,
1455 layout
, &foreground
, &background
);
1457 gdk_draw_line (drawing
->ruler
->window
,
1458 drawing
->ruler_gc_butt
,
1459 drawing
->ruler
->allocation
.width
/2, 1,
1460 drawing
->ruler
->allocation
.width
/2, 7);
1467 g_object_unref(layout
);
1473 /* notify mouse on ruler */
1475 motion_notify_ruler(GtkWidget
*widget
, GdkEventMotion
*event
, gpointer user_data
)
1477 //g_debug("motion");
1478 //eventually follow mouse and show time here
This page took 0.05784 seconds and 3 git commands to generate.