Commit eff0967c authored by ROOL's avatar ROOL 🤖

Tool idle event and trace bug fixes

Long standing disable of idle events when they are needed. Steps to recreate:
* Create a sprite with a palette
* Paint a little with any brush tool
* Go to Paint > Edit palette to open the colour picker (ensuring that the menu tree, the mouse, and the colour picker are within the bounds of the sprite view being painted)
* Collapse the menu tree and carry on painting with the brush tool
The brush tool now only produces output on click, not drag. This is because the idle events are no longer enabled, they were lost in merely opening the picker.

"oh god a sprite window's gone walkies" observed in trace during development.
Triggered when sprwindow_delete() is called when there's only one sprite window and you close it. This is because of an earlier change which commented out
  beforeus = /*(main_sprite_window *) &*/us->sprite->windows;
The additional addressof operation would have introduced one extra iteration to the loop that followed (with the beforeus->link variable at offset 0, it would just dereference the pointer on the first iteration). Now the case of beforeus == us is explicitly checked.

Submission for the Paint bounty.

Version 2.25. Tagged as 'Paint-2_25'
parent 3be21b3b
......@@ -9,12 +9,12 @@
GBLS Module_ApplicationDate
GBLS Module_HelpVersion
GBLS Module_ComponentName
Module_MajorVersion SETS "2.24"
Module_Version SETA 224
Module_MajorVersion SETS "2.25"
Module_Version SETA 225
Module_MinorVersion SETS ""
Module_Date SETS "08 Jun 2019"
Module_ApplicationDate SETS "08-Jun-19"
Module_Date SETS "17 Aug 2019"
Module_ApplicationDate SETS "17-Aug-19"
Module_ComponentName SETS "Paint"
Module_FullVersion SETS "2.24"
Module_HelpVersion SETS "2.24 (08 Jun 2019)"
Module_FullVersion SETS "2.25"
Module_HelpVersion SETS "2.25 (17 Aug 2019)"
END
/* (2.24)
/* (2.25)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 2.24
#define Module_MajorVersion_CMHG 2.25
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Jun 2019
#define Module_Date_CMHG 17 Aug 2019
#define Module_MajorVersion "2.24"
#define Module_Version 224
#define Module_MajorVersion "2.25"
#define Module_Version 225
#define Module_MinorVersion ""
#define Module_Date "08 Jun 2019"
#define Module_Date "17 Aug 2019"
#define Module_ApplicationDate "08-Jun-19"
#define Module_ApplicationDate "17-Aug-19"
#define Module_ComponentName "Paint"
#define Module_FullVersion "2.24"
#define Module_HelpVersion "2.24 (08 Jun 2019)"
#define Module_LibraryVersionInfo "2:24"
#define Module_FullVersion "2.25"
#define Module_HelpVersion "2.25 (17 Aug 2019)"
#define Module_LibraryVersionInfo "2:25"
......@@ -392,7 +392,13 @@ void sprwindow_claim_idle_events (main_window *window)
{ ftracef0 ("sprwindow_claim_idle_events\n");
window->data->sprite.sprite->needsnull = 1;
lastnullholder = win_idle_event_claimer ();
wimp_w claimer = win_idle_event_claimer ();
/* Don't overwrite the lastnullholder with this window otherwise nulls *
* will carry on after the current tool stops (if *
* sprwindow_claim_idle_events() was already called). */
if (claimer != window->handle)
lastnullholder = claimer;
main_claim_idle (window->handle);
}
......@@ -446,10 +452,12 @@ void sprwindow_event_handler (wimp_eventstr *e, void *handle)
{ case wimp_ENULL:
if (!read_only)
{ wimp_mousestr mouse;
main_sprite *sprite = window->data->sprite.sprite;
wimpt_noerr (wimp_get_point_info (&mouse));
ftracef2 ("mouse located at w 0x%X, i 0x%X\n", mouse.w, mouse.i);
if (mouse.w == window->handle && mouse.i == -1)
if (mouse.w == window->handle && mouse.i == -1 && sprite->needsnull)
toolwindow_current_tool->null_action (window, &mouse);
}
break;
......@@ -803,13 +811,15 @@ void sprwindow_delete (main_window *window)
m_FREE (us->title, 20);
beforeus = /*(main_sprite_window *) &*/us->sprite->windows;
while (beforeus != NULL && beforeus->link != us)
beforeus = beforeus->link;
if (beforeus != us)
{ while (beforeus != NULL && beforeus->link != us)
beforeus = beforeus->link;
if (beforeus != NULL)
beforeus->link = us->link;
else
ftracef0 ("oh god a sprite window's gone walkies\n");
if (beforeus != NULL)
beforeus->link = us->link;
else
ftracef0 ("oh god a sprite window's gone walkies\n");
}
/*If we are pointed at by the main_sprite for this sprite, set it to
our successor.*/
......
......@@ -2246,6 +2246,11 @@ static void textpaint_click (main_window *window, wimp_mousestr *mpos)
if ((mpos->bbits & (wimp_BLEFT | wimp_BRIGHT)) != 0)
{ main_sprite *sprite = window->data->sprite.sprite;
/* Without this code, dragging the text tool fails if attempted *
* immediately after clicking a text icon on the colour picker in *
* Edit Palette or the name on the Save dialogue. */
sprwindow_claim_idle_events (window); /* start tracking */
if (sprite->toolspace [0] == 1) textEOR (sprite);
sprite->toolspace [0] = 2;
ftracef2 ("0x%X->toolspace [0]: 0x%X\n",
......@@ -2582,6 +2587,11 @@ static void brushpaint_click (main_window *window, wimp_mousestr *mpos)
tools_brushsprite_ptr != NULL)
{ main_sprite *sprite = window->data->sprite.sprite;
/* Without this code, dragging the paint brush fails if attempted *
* immediately after clicking a text icon on the colour picker in *
* Edit Palette or the name on the Save dialogue. */
sprwindow_claim_idle_events (window); /* start tracking */
if (sprite->toolspace [0] == 1) brushEOR (sprite);
sprite->toolspace [0] = 2; /* had click, no EOR */
ftracef2 ("0x%X->toolspace [0]: 0x%X\n",
......
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