mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Better focus handling in a new window.
This commit is contained in:
parent
39c52ae868
commit
4c980d3e46
@ -1,5 +1,10 @@
|
||||
2007-11-24 David A. Capello <dacap@users.sourceforge.net>
|
||||
|
||||
* src/commands/cmd_new_frame.c (copy_cel_in_next_frame): Fixed
|
||||
undo for new frames in other layers.
|
||||
|
||||
* src/file/png_file.c (load_png): Finished.
|
||||
|
||||
* src/commands/cmd_configure_screen.c: Added the new dialog to
|
||||
select the graphics mode.
|
||||
|
||||
|
@ -57,6 +57,7 @@ void jmanager_set_focus(JWidget widget);
|
||||
void jmanager_set_mouse(JWidget widget);
|
||||
void jmanager_set_capture(JWidget widget);
|
||||
void jmanager_attract_focus(JWidget widget);
|
||||
void jmanager_focus_first_child(JWidget widget);
|
||||
void jmanager_free_focus(void);
|
||||
void jmanager_free_mouse(void);
|
||||
void jmanager_free_capture(void);
|
||||
|
@ -43,6 +43,12 @@
|
||||
|
||||
#define TOPWND(manager) (jlist_first_data((manager)->children))
|
||||
|
||||
#define ACCEPT_FOCUS(widget) \
|
||||
(((widget)->flags & (JI_FOCUSREST | \
|
||||
JI_DISABLED | \
|
||||
JI_HIDDEN | \
|
||||
JI_DECORATIVE)) == JI_FOCUSREST)
|
||||
|
||||
enum {
|
||||
STAGE_NORMAL,
|
||||
STAGE_WANT_CLOSE,
|
||||
@ -236,7 +242,8 @@ bool jmanager_poll(JWidget manager, bool all_windows)
|
||||
jwidget_show(window);
|
||||
|
||||
/* attract the focus to the magnetic widget */
|
||||
jmanager_attract_focus(window);
|
||||
/* jmanager_attract_focus(window); */
|
||||
jmanager_focus_first_child(window);
|
||||
|
||||
/* redraw all */
|
||||
/* jwidget_flush_redraw(window); */
|
||||
@ -698,6 +705,18 @@ void jmanager_attract_focus(JWidget widget)
|
||||
jmanager_set_focus(magnet);
|
||||
}
|
||||
|
||||
void jmanager_focus_first_child(JWidget widget)
|
||||
{
|
||||
JWidget it;
|
||||
|
||||
for (it=jwidget_get_window(widget); it; it=next_widget(it)) {
|
||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE))) {
|
||||
jmanager_set_focus(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void jmanager_free_focus(void)
|
||||
{
|
||||
jmanager_set_focus(NULL);
|
||||
@ -1263,13 +1282,7 @@ static void broadcast_key_msg(JWidget manager, JMessage msg)
|
||||
Focus Movement
|
||||
***********************************************************************/
|
||||
|
||||
#define ACCEPT_FOCUS(widget) \
|
||||
(((widget)->flags & (JI_FOCUSREST | \
|
||||
JI_DISABLED | \
|
||||
JI_HIDDEN | \
|
||||
JI_DECORATIVE)) == JI_FOCUSREST)
|
||||
|
||||
static bool move_focus (JWidget manager, JMessage msg)
|
||||
static bool move_focus(JWidget manager, JMessage msg)
|
||||
{
|
||||
int (*cmp)(JWidget, int, int) = NULL;
|
||||
JWidget focus = NULL;
|
||||
@ -1299,13 +1312,13 @@ static bool move_focus (JWidget manager, JMessage msg)
|
||||
c = 0;
|
||||
|
||||
/* list's 1st element is the focused widget */
|
||||
for (it=focus_widget; it; it=next_widget (it)) {
|
||||
if (ACCEPT_FOCUS (it) && !(childs_accept_focus (it, TRUE)))
|
||||
for (it=focus_widget; it; it=next_widget(it)) {
|
||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE)))
|
||||
list[c++] = it;
|
||||
}
|
||||
|
||||
for (it=window; it != focus_widget; it=next_widget (it)) {
|
||||
if (ACCEPT_FOCUS (it) && !(childs_accept_focus (it, TRUE)))
|
||||
for (it=window; it != focus_widget; it=next_widget(it)) {
|
||||
if (ACCEPT_FOCUS(it) && !(childs_accept_focus(it, TRUE)))
|
||||
list[c++] = it;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user