fix UI bug when placing text and immediately deleting it (did not delete)

This commit is contained in:
Stefan Frederik 2021-11-04 13:30:50 +01:00
parent 966ebdc26e
commit 7490c80a9c
5 changed files with 27 additions and 18 deletions

View File

@ -2,6 +2,7 @@ GUI_CFLAGS = -DPLUGIN_GUI
GUI_OBJS = \
$(BIN)/gui/find_gtk2.o \
$(BIN)/gui/find_gtk3.o \
$(BIN)/gui/find_gtk4.o \
$(BIN)/gui/find_lesstif2.o \
$(BIN)/gui/find_x.o \
$(BIN)/gui/find_gd.o \

View File

@ -32,29 +32,25 @@ int find_gtk3(const char *name, int logdepth, int fatal, const char *call, const
const char *test_c =
NL "#include <gtk/gtk.h>"
NL
NL "static void"
NL "activate (GtkApplication* app,"
NL " gpointer user_data)"
NL "static void activate(GtkApplication* app, gpointer user_data)"
NL "{"
NL " GtkWidget *window;"
NL
NL " window = gtk_application_window_new (app);"
NL " gtk_window_set_title (GTK_WINDOW (window), \"Window\");"
NL " gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);"
NL " gtk_widget_show_all (window);"
NL " window = gtk_application_window_new(app);"
NL " gtk_window_set_title(GTK_WINDOW(window), \"Window\");"
NL " gtk_window_set_default_size(GTK_WINDOW(window), 200, 200);"
NL " gtk_widget_show_all(window);"
NL "}"
NL
NL "int"
NL "main (int argc,"
NL " char **argv)"
NL "int main (int argc, char **argv)"
NL "{"
NL " GtkApplication *app;"
NL " int status;"
NL
NL " app = gtk_application_new (\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);"
NL " g_signal_connect (app, \"activate\", G_CALLBACK (activate), NULL);"
NL " status = g_application_run (G_APPLICATION (app), argc, argv);"
NL " g_object_unref (app);"
NL " app = gtk_application_new(\"org.gtk.example\", G_APPLICATION_FLAGS_NONE);"
NL " g_signal_connect(app, \"activate\", G_CALLBACK(activate), NULL);"
NL " status = g_application_run(G_APPLICATION(app), argc, argv);"
NL " g_object_unref(app);"
NL
NL " return status;"
NL "}"

View File

@ -6,6 +6,7 @@
#include "find_x.h"
#include "find_gtk2.h"
#include "find_gtk3.h"
#include "find_gtk4.h"
#include "find_lesstif2.h"
#include "find_gd.h"
#include "find_cairo.h"
@ -26,6 +27,8 @@ void deps_gui_init()
dep_add("libs/gui/gtk2/key_prefix", find_gtk2_key_prefix);
dep_add("libs/gui/gtk2/modversion", find_gtk2_modversion);
dep_add("libs/gui/gtk3/*", find_gtk3);
dep_add("libs/gui/gtk4/*", find_gtk4);
dep_add("libs/gui/gtk4/modversion", find_gtk4_modversion);
dep_add("libs/gui/lesstif2/exthi/*", find_lesstif2_exthi);
dep_add("libs/gui/lesstif2/*", find_lesstif2);
dep_add("libs/gui/libstroke/*", find_libstroke);

View File

@ -2323,10 +2323,11 @@ void place_text(int draw_text, double mx, double my)
cairo_restore(xctx->cairo_save_ctx);
}
#endif
select_text(xctx->texts, SELECTED, 0);
xctx->texts++;
select_text(xctx->texts - 1, SELECTED, 0);
rebuild_selected_array(); /* sets xctx->ui_state |= SELECTION */
drawtemprect(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
drawtempline(gc[SELLAYER], END, 0.0, 0.0, 0.0, 0.0);
xctx->texts++;
set_modify(1);
}

View File

@ -725,7 +725,11 @@ int callback(int event, int mx, int my, KeySym key,
{
if(xctx->semaphore >= 2) break;
xctx->last_command = 0;
place_text(1, xctx->mousex_snap, xctx->mousey_snap); /* 1 = draw text 24122002 */
place_text(0, xctx->mousex_snap, xctx->mousey_snap); /* 1 = draw text 24122002 */
xctx->mx_save = mx; xctx->my_save = my;
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
move_objects(START,0,0,0);
break;
}
if(key=='r' && !xctx->ui_state && state==0) /* start rect */
@ -1500,7 +1504,11 @@ int callback(int event, int mx, int my, KeySym key,
break;
case 6:
xctx->last_command = 0;
place_text(1, xctx->mousex_snap, xctx->mousey_snap); /* 1 = draw text */
place_text(0, xctx->mousex_snap, xctx->mousey_snap); /* 1 = draw text */
xctx->mx_save = mx; xctx->my_save = my;
xctx->mx_double_save=xctx->mousex_snap;
xctx->my_double_save=xctx->mousey_snap;
move_objects(START,0,0,0);
break;
case 7: /* cut selection into clipboard */
rebuild_selected_array();