Skip to content

Commit

Permalink
Apply Guichan's changes from e5271f1ad79923ffa1810e2bc62435117d49ce9f…
Browse files Browse the repository at this point in the history
… (Feb 8th 2008)

Focus is now requested by a pressed widget before the widget distribute its events making it possible to remove a widget from the Gui in one of the event handlers without raising an exception. See http://code.google.com/p/guichan/issues/detail?id=24
  • Loading branch information
Jarod42 committed Aug 11, 2024
1 parent 813e863 commit abba23d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
* Continue rebasing from 2bc3319195c94fd4ba3d87e0a9f095bca211646e
* Continue rebasing from 29eb696aaf7aa7a78cece7d25f27d0235e4559ed
* Add a focus listener interface.
* Make focus apply synchronously.
* Graphics and input objects for DirectX.
Expand Down
16 changes: 8 additions & 8 deletions src/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,22 +518,22 @@ namespace gcn

int sourceWidgetX, sourceWidgetY;
sourceWidget->getAbsolutePosition(sourceWidgetX, sourceWidgetY);

distributeMouseEvent(sourceWidget,
MouseEvent::PRESSED,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());

mFocusHandler->setLastWidgetPressed(sourceWidget);

if (mFocusHandler->getModalFocused() != NULL
&& sourceWidget->isModalFocused()
|| mFocusHandler->getModalFocused() == NULL)
{
sourceWidget->requestFocus();
}

distributeMouseEvent(sourceWidget,
MouseEvent::PRESSED,
mouseInput.getButton(),
mouseInput.getX(),
mouseInput.getY());

mFocusHandler->setLastWidgetPressed(sourceWidget);

mFocusHandler->setDraggedWidget(sourceWidget);
mLastMouseDragButton = mouseInput.getButton();

Expand Down

0 comments on commit abba23d

Please sign in to comment.