From d4a00f67fecf483e777ba010530036a0f2c606ac Mon Sep 17 00:00:00 2001 From: oliverschmidt Date: Tue, 15 Aug 2006 00:11:45 +0000 Subject: [PATCH] The program_handler_add() mechanism relied on being used after the initialization of the program_handler (and the ctk) process but before entering the event handling. In Contiki 2.x there's no such explicit process initialization anymore - and the implicit asynchronous initialization runs after program_handler_add(). Therefore the initialization of the data structures modified by program_handler_add() had to be removed from that asynchronous process initialization. Instead C-langugae global data.initialization is used. --- apps/program-handler/program-handler.c | 5 ++--- core/ctk/ctk.c | 10 ++-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/apps/program-handler/program-handler.c b/apps/program-handler/program-handler.c index aadb1ff70..6fa48ffad 100644 --- a/apps/program-handler/program-handler.c +++ b/apps/program-handler/program-handler.c @@ -43,7 +43,7 @@ * * This file is part of the Contiki desktop OS * - * $Id: program-handler.c,v 1.1 2006/06/17 22:41:12 adamdunkels Exp $ + * $Id: program-handler.c,v 1.2 2006/08/15 00:11:45 oliverschmidt Exp $ * */ @@ -57,7 +57,7 @@ /* Menus */ -static struct ctk_menu contikimenu; +static struct ctk_menu contikimenu = {NULL, "Contiki", 7, 0, 0}; #ifndef PROGRAM_HANDLER_CONF_MAX_NUMDSCS #define MAX_NUMDSCS 10 @@ -278,7 +278,6 @@ PROCESS_THREAD(program_handler_process, ev, data) PROCESS_BEGIN(); /* Create the menus */ - ctk_menu_new(&contikimenu, "Contiki"); ctk_menu_add(&contikimenu); #if WITH_LOADER_ARCH runmenuitem = ctk_menuitem_add(&contikimenu, "Run program..."); diff --git a/core/ctk/ctk.c b/core/ctk/ctk.c index 3b7e41e07..c263f09c3 100644 --- a/core/ctk/ctk.c +++ b/core/ctk/ctk.c @@ -44,7 +44,7 @@ * * This file is part of the Contiki operating system. * - * $Id: ctk.c,v 1.2 2006/08/13 14:11:41 oliverschmidt Exp $ + * $Id: ctk.c,v 1.3 2006/08/15 00:13:23 oliverschmidt Exp $ * */ @@ -1360,12 +1360,8 @@ PROCESS_THREAD(ctk_process, ev, data) ctk_mouse_show(); #endif /* CTK_CONF_MOUSE_SUPPORT */ - ctk_draw_init(); + ctk_restore(); - height = ctk_draw_height(); - width = ctk_draw_width(); - - desktop_window.active = NULL; desktop_window.owner = &ctk_process; ctk_signal_keypress = process_alloc_event(); @@ -1397,8 +1393,6 @@ PROCESS_THREAD(ctk_process, ev, data) iconx = ICONX_START; icony = ICONY_START; - redraw = REDRAW_ALL; - timer_set(&timer, CLOCK_SECOND); while(1) {