Commit e55cbd9a authored by Michael Gerbracht's avatar Michael Gerbracht Committed by ROOL
Browse files

Small cleanups

Detail:
* Make use of NULL_ObjectID
* Mark event handlers as static
parent 6aa449d7
......@@ -117,7 +117,7 @@ extern _kernel_oserror *close_dialogue (ColourDboxInternal *internal, TaskDescri
if ((e = _kernel_swi (Wimp_GetWindowState, &regs, &regs)) != NULL) {
if (e->errnum == 0x288) {
DEBUG debug_output ("e","failed - invliad window handle\n");
DEBUG debug_output ("e","failed - invalid window handle\n");
dialogue_hidden (internal);
} else {
return e;
......@@ -168,7 +168,7 @@ extern _kernel_oserror *dialogue_hidden (ColourDboxInternal *internal) {
internal->dialogue_handle =
internal->window_handle = 0;
if (object_id == global_menu) global_menu = 0;
if (object_id == global_menu) global_menu = NULL_ObjectID;
return (internal->flags & ColourDboxInternal_GenerateHideEvent) ? dialogue_completed (object_id) : NULL;
}
......
......@@ -90,7 +90,7 @@ extern _kernel_oserror *delete_object (_kernel_swi_regs *r, TaskDescriptor *t)
e = deregister_task(t);
*/
}
if (object_id == global_menu) global_menu = 0;
if (object_id == global_menu) global_menu = NULL_ObjectID;
if (internal->forward == internal) { /* Unlinking from the list is regarded as imperative */
t->object_list = NULL;
......
......@@ -41,14 +41,13 @@
#include "object.h"
#include "events.h"
_kernel_oserror *event_help_request (wimp_Message message_block, TaskDescriptor *t, IDBlock *id_block, _kernel_swi_regs *r);
_kernel_oserror *event_colourdbox_to_show (ObjectID object_id);
_kernel_oserror *event_colourdbox_to_close (TaskDescriptor *t, wimp_PollBlock *block, IDBlock *id_block, _kernel_swi_regs *r);
_kernel_oserror *event_menus_deleted (TaskDescriptor *t);
_kernel_oserror *event_picker_choice (TaskDescriptor *t, wimp_PollBlock *block);
_kernel_oserror *event_colour_changed (TaskDescriptor *t, wimp_PollBlock *block);
_kernel_oserror *event_reset_colour (TaskDescriptor *t, wimp_PollBlock *block);
static _kernel_oserror *update_dialogue (ColourDboxInternal *internal);
static _kernel_oserror *event_colourdbox_to_show (ObjectID object_id);
static _kernel_oserror *event_colourdbox_to_close (TaskDescriptor *t, wimp_PollBlock *block, IDBlock *id_block, _kernel_swi_regs *r);
static _kernel_oserror *event_menus_deleted (TaskDescriptor *t);
static _kernel_oserror *event_picker_choice (TaskDescriptor *t, wimp_PollBlock *block);
static _kernel_oserror *event_colour_changed (TaskDescriptor *t, wimp_PollBlock *block);
static _kernel_oserror *event_reset_colour (TaskDescriptor *t, wimp_PollBlock *block);
static _kernel_oserror *update_dialogue (ColourDboxInternal *internal);
extern _kernel_oserror *events_postfilter (_kernel_swi_regs *r)
{
......@@ -90,21 +89,14 @@ extern _kernel_oserror *events_postfilter (_kernel_swi_regs *r)
switch (block->msg.hdr.action) {
case wimp_MMENUS_DELETED:
return event_menus_deleted (t);
break;
case colourpicker_MCOLOURCHANGED: /* Colour was changed by user */
return event_colour_changed (t, block);
case colourpicker_MPICKERCHOICE: /* User clicked ok to set new colour */
return event_picker_choice (t, block);
break;
case colourpicker_MCLOSEDIALOGUEREQUEST:
return event_colourdbox_to_close(t, block, id_block, r);
case colourpicker_MRESETCOLOURREQUEST:
return event_reset_colour (t, block);
/* No longer handled (bug in ColourPicker module)
case wimp_MHELP_REQUEST:
return event_help_request(block->msg,t,id_block,r);
break;
*/
default:
break;
}
......@@ -153,53 +145,7 @@ extern _kernel_oserror *events_prefilter (_kernel_swi_regs *r)
return NULL;
}
/*
_kernel_oserror *event_help_request (wimp_Message message_block, TaskDescriptor *t, IDBlock *id_block, _kernel_swi_regs *r) {
_kernel_oserror *e;
_kernel_swi_regs regs;
ColourDboxInternal *internal;
wimp_Message help_reply;
int str_len;
DEBUG debug_output ("e","Menu: request for help\n");
IGNORE(t);
if ((internal = find_internal_w (message_block.data.help_request.window_handle, t)) == NULL)
return NULL;
if (!internal->help_message) return NULL;
help_reply.hdr.your_ref = message_block.hdr.my_ref;
help_reply.hdr.action = wimp_MHELP_REPLY;
help_reply.hdr.size = sizeof(wimp_Message);
string_copy_chk (help_reply.data.chars, internal->help_message, wimp_MAX_MSG_DATA_SIZE);
str_len = strlen(help_reply.data.chars);
if (str_len < wimp_MAX_MSG_DATA_SIZE) {
help_reply.data.chars[str_len+1] = '\0';
if (str_len+1 < wimp_MAX_MSG_DATA_SIZE)
help_reply.data.chars[str_len+2] = '\0';
}
regs.r[0] = wimp_ESEND;
regs.r[1] = (int) &help_reply;
regs.r[2] = message_block.hdr.task_handle;
if ((e = _kernel_swi (Wimp_SendMessage, &regs, &regs)) != NULL) {
return e;
}
r->r[0] = 1;
id_block->self_id = internal->object_id;
return NULL;
}
*/
_kernel_oserror *event_colourdbox_to_show (ObjectID object_id) {
static _kernel_oserror *event_colourdbox_to_show (ObjectID object_id) {
_kernel_oserror *e;
_kernel_swi_regs regs;
......@@ -217,7 +163,7 @@ _kernel_oserror *event_colourdbox_to_show (ObjectID object_id) {
return NULL;
}
_kernel_oserror *event_colourdbox_to_close (TaskDescriptor *t, wimp_PollBlock *block, IDBlock *id_block, _kernel_swi_regs *r) {
static _kernel_oserror *event_colourdbox_to_close (TaskDescriptor *t, wimp_PollBlock *block, IDBlock *id_block, _kernel_swi_regs *r) {
_kernel_oserror *e;
ColourDboxInternal *internal;
......@@ -242,7 +188,7 @@ _kernel_oserror *event_colourdbox_to_close (TaskDescriptor *t, wimp_PollBlo
return NULL;
}
_kernel_oserror *event_menus_deleted (TaskDescriptor *t) {
static _kernel_oserror *event_menus_deleted (TaskDescriptor *t) {
_kernel_oserror *e;
_kernel_swi_regs regs;
......@@ -292,7 +238,7 @@ _kernel_oserror *event_menus_deleted (TaskDescriptor *t) {
return NULL;
}
_kernel_oserror *event_picker_choice (TaskDescriptor *t, wimp_PollBlock *block) {
static _kernel_oserror *event_picker_choice (TaskDescriptor *t, wimp_PollBlock *block) {
_kernel_oserror *e;
_kernel_swi_regs regs;
......@@ -335,7 +281,7 @@ _kernel_oserror *event_picker_choice (TaskDescriptor *t, wimp_PollBlock
return NULL;
}
_kernel_oserror *event_colour_changed (TaskDescriptor *t, wimp_PollBlock *block) {
static _kernel_oserror *event_colour_changed (TaskDescriptor *t, wimp_PollBlock *block) {
ColourDboxInternal *internal;
ColourPicker_ColourChanged_Event *colour_changed = (ColourPicker_ColourChanged_Event *) block;
......@@ -360,7 +306,7 @@ _kernel_oserror *event_colour_changed (TaskDescriptor *t, wimp_PollBlock
return NULL;
}
_kernel_oserror *event_reset_colour (TaskDescriptor *t, wimp_PollBlock *block) {
static _kernel_oserror *event_reset_colour (TaskDescriptor *t, wimp_PollBlock *block) {
ColourDboxInternal *internal;
ColourPicker_ResetColourRequest_Event *reset_colour_event = (ColourPicker_ResetColourRequest_Event *) block;
......
......@@ -106,6 +106,7 @@ extern _kernel_oserror *show_object (_kernel_swi_regs *r, TaskDescriptor *t)
/* Just in case the client shows one transient followed quickly by another */
internal->flags &= (~ColourDboxInternal_MenuSemantics & ~ColourDboxInternal_SubMenuSemantics);
internal->show_type = user_regs->r[2];
if (internal->flags & ColourDboxInternal_IsShowing) {
......
......@@ -111,7 +111,7 @@ extern void task_remove (int task_handle)
j = i->forward;
if (global_menu == i->object_id)
global_menu = NULL;
global_menu = NULL_ObjectID;
if (global_next == i)
global_next = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment