gpointer user_data)
{
end_text();
- reset_focus();
if (close_journal()) {
new_journal();
ui.zoom = ui.startup_zoom;
gboolean success;
end_text();
- reset_focus();
if (!ok_to_close()) return; // user aborted on save confirmation
dialog = gtk_file_chooser_dialog_new(_("Open PDF"), GTK_WINDOW (winMain),
gboolean success;
end_text();
- reset_focus();
if (!ok_to_close()) return; // user aborted on save confirmation
dialog = gtk_file_chooser_dialog_new(_("Open Journal"), GTK_WINDOW (winMain),
GtkWidget *dialog;
end_text();
- reset_focus();
if (ui.filename == NULL) {
on_fileSaveAs_activate(menuitem, user_data);
return;
struct stat stat_buf;
end_text();
- reset_focus();
dialog = gtk_file_chooser_dialog_new(_("Save Journal"), GTK_WINDOW (winMain),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL);
char *in_fn, *p;
end_text();
- reset_focus();
if (!gtk_check_version(2, 10, 0)) {
print = gtk_print_operation_new();
/*
gboolean warn;
end_text();
- reset_focus();
dialog = gtk_file_chooser_dialog_new(_("Export to PDF"), GTK_WINDOW (winMain),
GTK_FILE_CHOOSER_ACTION_SAVE, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL);
gpointer user_data)
{
end_text();
- reset_focus();
if (ok_to_close()) gtk_main_quit ();
}
GnomeCanvasGroup *group;
end_text();
- reset_focus();
if (undo == NULL) return; // nothing to undo!
reset_selection(); // safer
+ reset_recognizer(); // safer
if (undo->type == ITEM_STROKE || undo->type == ITEM_TEXT) {
// we're keeping the stroke info, but deleting the canvas item
gtk_object_destroy(GTK_OBJECT(undo->item->canvas_item));
GnomeCanvasGroup *group;
end_text();
- reset_focus();
if (redo == NULL) return; // nothing to redo!
reset_selection(); // safer
+ reset_recognizer(); // safer
if (redo->type == ITEM_STROKE || redo->type == ITEM_TEXT) {
// re-create the canvas_item
make_canvas_item_one(redo->layer->group, redo->item);
gpointer user_data)
{
end_text();
- reset_focus();
selection_to_clip();
selection_delete();
}
gpointer user_data)
{
end_text();
- reset_focus();
selection_to_clip();
}
gpointer user_data)
{
end_text();
- reset_focus();
clipboard_paste();
}
gpointer user_data)
{
end_text();
- reset_focus();
selection_delete();
}
double yscroll;
struct Page *pg;
- reset_focus();
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
if (ui.view_continuous) return;
ui.view_continuous = TRUE;
GtkAdjustment *v_adj;
double yscroll;
- reset_focus();
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
if (!ui.view_continuous) return;
ui.view_continuous = FALSE;
on_viewZoomIn_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- reset_focus();
if (ui.zoom > MAX_ZOOM) return;
ui.zoom *= ui.zoom_step_factor;
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
on_viewZoomOut_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- reset_focus();
if (ui.zoom < MIN_ZOOM) return;
ui.zoom /= ui.zoom_step_factor;
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
on_viewNormalSize_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- reset_focus();
ui.zoom = DEFAULT_ZOOM;
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
rescale_text_items();
on_viewPageWidth_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
- reset_focus();
ui.zoom = (GTK_WIDGET(canvas))->allocation.width/ui.cur_page->width;
gnome_canvas_set_pixels_per_unit(canvas, ui.zoom);
rescale_text_items();
gpointer user_data)
{
end_text();
- reset_focus();
do_switch_page(0, TRUE, FALSE);
}
gpointer user_data)
{
end_text();
- reset_focus();
if (ui.pageno == 0) return;
do_switch_page(ui.pageno-1, TRUE, FALSE);
}
gpointer user_data)
{
end_text();
- reset_focus();
if (ui.pageno == journal.npages-1) { // create a page at end
on_journalNewPageEnd_activate(menuitem, user_data);
return;
gpointer user_data)
{
end_text();
- reset_focus();
do_switch_page(journal.npages-1, TRUE, FALSE);
}
gpointer user_data)
{
end_text();
- reset_focus();
if (ui.layerno == ui.cur_page->nlayers-1) return;
reset_selection();
ui.layerno++;
gpointer user_data)
{
end_text();
- reset_focus();
if (ui.layerno == -1) return;
reset_selection();
gnome_canvas_item_hide(GNOME_CANVAS_ITEM(ui.cur_layer->group));
struct Page *pg;
end_text();
- reset_focus();
reset_selection();
pg = new_page(ui.cur_page);
journal.pages = g_list_insert(journal.pages, pg, ui.pageno);
struct Page *pg;
end_text();
- reset_focus();
reset_selection();
pg = new_page(ui.cur_page);
journal.pages = g_list_insert(journal.pages, pg, ui.pageno+1);
struct Page *pg;
end_text();
- reset_focus();
reset_selection();
pg = new_page((struct Page *)g_list_last(journal.pages)->data);
journal.pages = g_list_append(journal.pages, pg);
struct Layer *l;
end_text();
- reset_focus();
if (journal.npages == 1) return;
reset_selection();
+ reset_recognizer(); // safer
prepare_new_undo();
undo->type = ITEM_DELETE_PAGE;
undo->val = ui.pageno;
struct Layer *l;
end_text();
- reset_focus();
reset_selection();
l = g_new(struct Layer, 1);
l->items = NULL;
GList *list;
end_text();
- reset_focus();
if (ui.cur_layer == NULL) return;
reset_selection();
+ reset_recognizer(); // safer
prepare_new_undo();
undo->type = ITEM_DELETE_LAYER;
undo->val = ui.layerno;
GList *pglist;
end_text();
- reset_focus();
papersize_dialog = create_papersizeDialog();
papersize_width = ui.cur_page->width;
papersize_height = ui.cur_page->height;
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_WHITE);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_YELLOW);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_RED);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_ORANGE);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_BLUE);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_papercolor_activate(menuitem, COLOR_GREEN);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_paperstyle_activate(menuitem, RULING_NONE);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_paperstyle_activate(menuitem, RULING_LINED);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_paperstyle_activate(menuitem, RULING_RULED);
}
gpointer user_data)
{
end_text();
- reset_focus();
process_paperstyle_activate(menuitem, RULING_GRAPH);
}
gboolean attach;
end_text();
- reset_focus();
dialog = gtk_file_chooser_dialog_new(_("Open Background"), GTK_WINDOW (winMain),
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL);
struct Background *bg;
end_text();
- reset_focus();
reset_selection();
gtk_window_iconify(GTK_WINDOW(winMain)); // hide ourselves
gdk_display_sync(gdk_display_get_default());
gboolean active;
end_text();
- reset_focus();
active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
if (active == ui.bg_apply_all_pages) return;
ui.bg_apply_all_pages = active;
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
end_text();
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_PEN;
ui.cur_brush = &(ui.brushes[ui.cur_mapping][TOOL_PEN]);
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
end_text();
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_ERASER;
ui.cur_brush = &(ui.brushes[ui.cur_mapping][TOOL_ERASER]);
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
end_text();
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_HIGHLIGHTER;
ui.cur_brush = &(ui.brushes[ui.cur_mapping][TOOL_HIGHLIGHTER]);
if (ui.toolno[ui.cur_mapping] == TOOL_TEXT) return;
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_TEXT;
ui.cur_brush = &(ui.brushes[ui.cur_mapping][TOOL_PEN]);
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
end_text();
- reset_focus();
ui.toolno[ui.cur_mapping] = TOOL_SELECTRECT;
update_mapping_linkings(-1);
update_tool_buttons();
ui.cur_mapping = 0; // don't use switch_mapping() (refreshes buttons too soon)
end_text();
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_VERTSPACE;
update_mapping_linkings(-1);
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
end_text();
- reset_focus();
ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_STANDARD;
update_mapping_linkings(TOOL_ERASER);
}
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
end_text();
- reset_focus();
ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_WHITEOUT;
update_mapping_linkings(TOOL_ERASER);
}
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem))) return;
end_text();
- reset_focus();
ui.brushes[0][TOOL_ERASER].tool_options = TOOLOPT_ERASER_STROKES;
update_mapping_linkings(TOOL_ERASER);
}
g_free(str);
if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK) {
gtk_widget_destroy(dialog);
- reset_focus();
return;
}
str = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));
{
switch_mapping(0);
end_text();
- reset_focus();
reset_selection();
g_memmove(&(ui.brushes[0][TOOL_PEN]), ui.default_brushes+TOOL_PEN, sizeof(struct Brush));
ui.toolno[0] = TOOL_PEN;
{
switch_mapping(0);
end_text();
- reset_focus();
reset_selection();
g_memmove(&(ui.brushes[0][TOOL_ERASER]), ui.default_brushes+TOOL_ERASER, sizeof(struct Brush));
ui.toolno[0] = TOOL_ERASER;
{
switch_mapping(0);
end_text();
- reset_focus();
reset_selection();
g_memmove(&(ui.brushes[0][TOOL_HIGHLIGHTER]), ui.default_brushes+TOOL_HIGHLIGHTER, sizeof(struct Brush));
ui.toolno[0] = TOOL_HIGHLIGHTER;
{
switch_mapping(0);
if (ui.toolno[0]!=TOOL_TEXT) end_text();
- reset_focus();
reset_selection();
ui.toolno[0] = TOOL_TEXT;
ui.cur_brush = &(ui.brushes[0][TOOL_PEN]);
ui.default_font_size = ui.font_size;
}
end_text();
- reset_focus();
}
ui.cur_mapping = 0;
end_text();
- reset_focus();
if (ui.toolno[ui.cur_mapping]!=TOOL_PEN && ui.toolno[ui.cur_mapping]!=TOOL_HIGHLIGHTER) {
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_PEN;
ui.cur_mapping = 0;
end_text();
- reset_focus();
if (ui.toolno[ui.cur_mapping]!=TOOL_PEN && ui.toolno[ui.cur_mapping]!=TOOL_HIGHLIGHTER) {
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_PEN;
gpointer user_data)
{
end_text();
- reset_focus();
save_config_to_file();
}
GtkLabel *labelTitle;
end_text();
- reset_focus();
aboutDialog = create_aboutDialog ();
labelTitle = GTK_LABEL(g_object_get_data(G_OBJECT(aboutDialog), "labelTitle"));
gtk_label_set_markup(labelTitle,
return;
}
end_text();
- reset_focus();
switch_mapping(0);
if (ui.toolno[0] < NUM_STROKE_TOOLS) {
g_memmove(&(ui.brushes[0][ui.toolno[0]]), ui.default_brushes+ui.toolno[0], sizeof(struct Brush));
event->device->name, event->x, event->y, event->button, event->state);
#endif
- if (ui.cur_item_type != ITEM_TEXT) // remove focus from other elements
- gtk_widget_grab_focus(GTK_WIDGET(canvas));
+ // abort any page changes pending in the spin button, and take the focus
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(GET_COMPONENT("spinPageNo")), ui.pageno+1);
+ reset_focus();
is_core = (event->device == gdk_device_get_core_pointer());
if (!ui.use_xinput && !is_core) return FALSE;
else if (event->button == 5) scroll_event.scroll.direction = GDK_SCROLL_DOWN;
else if (event->button == 6) scroll_event.scroll.direction = GDK_SCROLL_LEFT;
else scroll_event.scroll.direction = GDK_SCROLL_RIGHT;
- printf("sending...\n");
gtk_widget_event(GET_COMPONENT("scrolledwindowMain"), &scroll_event);
}
return FALSE;
if (event->keyval == GDK_Escape) {
if (ui.cur_item_type == ITEM_TEXT) {
end_text();
- reset_focus();
return TRUE;
}
else if (ui.fullscreen) {
if (ui.in_update_page_stuff) return; // avoid a bad retroaction
end_text();
- reset_focus();
val = gtk_combo_box_get_active(combobox);
if (val == -1) return;
gpointer user_data)
{
end_text();
- reset_focus();
if (ok_to_close()) gtk_main_quit();
return TRUE;
}
gpointer user_data)
{
end_text();
- reset_focus();
ui.allow_xinput = ui.use_xinput =
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
end_text();
do_switch_page(ui.pageno, FALSE, FALSE);
}
- reset_focus();
return;
}
int val;
if (ui.in_update_page_stuff) return; // avoid a bad retroaction
-
+
+ /* in preparation for end_text(), send focus to the canvas if it's not ours.
+ (avoid issues with Gtk trying to send focus to the dead text widget) */
+
+ if (!GTK_WIDGET_HAS_FOCUS(spinbutton))
+ gtk_widget_grab_focus(GTK_WIDGET(canvas));
end_text();
- reset_focus();
val = gtk_spin_button_get_value_as_int(spinbutton) - 1;
GList *pglist;
end_text();
- reset_focus();
reset_selection();
pg = ui.cur_page;
if (ui.cur_page->bg->type != BG_SOLID) return;
end_text();
- reset_focus();
prepare_new_undo();
undo->type = ITEM_NEW_DEFAULT_BG;
undo->val_x = ui.default_page.width;
gpointer user_data)
{
end_text();
- reset_focus();
ui.use_erasertip =
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
update_mappings_menu();
active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
if (ui.progressive_bg == active) return;
end_text();
- reset_focus();
ui.progressive_bg = active;
if (!ui.progressive_bg) rescale_bg_pixmaps();
}
GtkWidget *dialog;
end_text();
- reset_focus();
if (!ok_to_close()) return; // user aborted on save confirmation
for (which = 0 ; which < MRU_SIZE; which++) {
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
end_text();
- reset_focus();
ui.linked_brush[1] = BRUSH_LINKED;
for (i=0;i<NUM_STROKE_TOOLS;i++) update_mapping_linkings(i);
}
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
end_text();
- reset_focus();
if (ui.toolno[1] >= NUM_STROKE_TOOLS) {
ui.linked_brush[1] = BRUSH_STATIC;
update_mappings_menu_linkings();
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
end_text();
- reset_focus();
ui.linked_brush[2] = BRUSH_LINKED;
for (i=0;i<NUM_STROKE_TOOLS;i++) update_mapping_linkings(i);
}
{
if (!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem))) return;
end_text();
- reset_focus();
if (ui.toolno[2] >= NUM_STROKE_TOOLS) {
ui.linked_brush[2] = BRUSH_STATIC;
update_mappings_menu_linkings();
GtkSpinButton *spinZoom;
end_text();
- reset_focus();
zoom_dialog = create_zoomDialog();
zoom_percent = 100*ui.zoom / DEFAULT_ZOOM;
spinZoom = GTK_SPIN_BUTTON(g_object_get_data(G_OBJECT(zoom_dialog), "spinZoom"));
ui.cur_mapping = 0;
end_text();
- reset_focus();
reset_selection();
ui.toolno[ui.cur_mapping] = TOOL_HAND;
update_mapping_linkings(-1);
gpointer user_data)
{
end_text();
- reset_focus();
ui.print_ruling = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
}
gpointer user_data)
{
end_text();
- reset_focus();
ui.discard_corepointer =
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
update_mappings_menu();
gpointer user_data)
{
end_text();
- reset_focus();
ui.left_handed = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
gtk_scrolled_window_set_placement(GTK_SCROLLED_WINDOW(GET_COMPONENT("scrolledwindowMain")),
ui.left_handed?GTK_CORNER_TOP_RIGHT:GTK_CORNER_TOP_LEFT);
GtkWidget *w;
end_text();
- reset_focus();
ui.shorten_menus = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
/* go over the item list */
gpointer user_data)
{
end_text();
- reset_focus();
ui.auto_save_prefs = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
}
{
int i;
end_text();
- reset_focus();
ui.pressure_sensitivity =
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
for (i=0; i<=NUM_BUTTONS; i++)
gpointer user_data)
{
end_text();
- reset_focus();
switch_mapping(0);
ui.button_switch_mapping = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM (menuitem));
}