editor: deactivate old text model before activating the new one
This commit is contained in:
parent
1e51fecdf5
commit
591cfca4e8
@ -20,6 +20,7 @@
|
|||||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -233,22 +234,29 @@ button_handler(struct widget *widget,
|
|||||||
x -= allocation.x;
|
x -= allocation.x;
|
||||||
y -= allocation.y;
|
y -= allocation.y;
|
||||||
|
|
||||||
editor->entry->active = 0;
|
int32_t activate_entry = rectangle_contains(&editor->entry->allocation, x, y);
|
||||||
editor->editor->active = 0;
|
int32_t activate_editor = rectangle_contains(&editor->editor->allocation, x, y);
|
||||||
|
assert(!(activate_entry && activate_editor));
|
||||||
|
|
||||||
editor->entry->active = rectangle_contains(&editor->entry->allocation, x, y);
|
if (activate_entry) {
|
||||||
editor->editor->active = rectangle_contains(&editor->editor->allocation, x, y);
|
if (editor->editor->active)
|
||||||
|
text_entry_deactivate(editor->editor);
|
||||||
if (editor->entry->active) {
|
if (!editor->entry->active)
|
||||||
text_entry_activate(editor->entry);
|
text_entry_activate(editor->entry);
|
||||||
|
} else if (activate_editor) {
|
||||||
|
if (editor->entry->active)
|
||||||
|
text_entry_deactivate(editor->entry);
|
||||||
|
if (!editor->editor->active)
|
||||||
|
text_entry_activate(editor->editor);
|
||||||
} else {
|
} else {
|
||||||
text_entry_deactivate(editor->entry);
|
if (editor->entry->active)
|
||||||
}
|
text_entry_deactivate(editor->entry);
|
||||||
if (editor->editor->active) {
|
if (editor->editor->active)
|
||||||
text_entry_activate(editor->editor);
|
text_entry_deactivate(editor->editor);
|
||||||
} else {
|
|
||||||
text_entry_deactivate(editor->editor);
|
|
||||||
}
|
}
|
||||||
|
editor->entry->active = activate_entry;
|
||||||
|
editor->editor->active = activate_editor;
|
||||||
|
assert(!(editor->entry->active && editor->editor->active));
|
||||||
|
|
||||||
widget_schedule_redraw(widget);
|
widget_schedule_redraw(widget);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user