Attached are several gtk fixes. They aren't very related, but they're
each small. A description of each diff block is:
* Make sure the ListBox widget is created before modifying it.
* Call DropGraphics() when a widget is unmapped to conserve resources
and because DropGraphics() ends up being called from the map signal
handler so nothing is saved by not calling it.
* Remove the nearly identical accent / character macro re-definitions.
* Make sure widget is realized before grabbing the primary selection.
* Ensure the caret is visible after a selection is pasted.
* Ensure uri data is NULL-terminated before calling NotifyURIDropped.
John
diff -rup --exclude CVS /src/scint-cvs/scintilla/gtk/PlatGTK.cxx
./gtk/PlatGTK.cxx
--- /src/scint-cvs/scintilla/gtk/PlatGTK.cxx Wed Mar 29 11:21:55 2006
+++ ./gtk/PlatGTK.cxx Sun Apr 23 22:01:37 2006
@@ -2047,7 +2122,7 @@ void ListBoxX::SetFont(Font &scint_font)
}
#else
// Only do for Pango font as there have been crashes for GDK fonts
- if (PFont(scint_font)->pfd) {
+ if (Created() && PFont(scint_font)->pfd) {
// Current font is Pango font
gtk_widget_modify_font(PWidget(list), PFont(scint_font)->pfd);
}
diff -rup --exclude CVS /src/scint-cvs/scintilla/gtk/ScintillaGTK.cxx
./gtk/ScintillaGTK.cxx
--- /src/scint-cvs/scintilla/gtk/ScintillaGTK.cxx Fri Apr 21 12:44:56 2006
+++ ./gtk/ScintillaGTK.cxx Fri Apr 21 18:31:20 2006
@@ -527,6 +532,7 @@ void ScintillaGTK::Map(GtkWidget *widget
void ScintillaGTK::UnMapThis() {
//Platform::DebugPrintf("ScintillaGTK::unmap this\n");
GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_MAPPED);
+ DropGraphics();
gdk_window_hide(PWidget(wMain)->window);
gtk_widget_unmap(PWidget(wText));
gtk_widget_unmap(PWidget(scrollbarh));
@@ -1187,15 +1202,7 @@ const char *ScintillaGTK::CharacterSetID
((x) >= 0 && (x) <= 128)
#define IS_ACC_OR_CHAR(x) \
- (IS_CHAR(x)) || (IS_ACC(x))
-
-#define IS_ACC(x) \
- ((x) >= 65103 && (x) <= 65111)
-#define IS_CHAR(x) \
- ((x) >= 0 && (x) <= 128)
-
-#define IS_ACC_OR_CHAR(x) \
- (IS_CHAR(x)) || (IS_ACC(x))
+ (IS_CHAR(x) || IS_ACC(x))
static int MakeAccent(int key, int acc) {
const char *conv[] = {
@@ -1399,7 +1410,7 @@ bool ScintillaGTK::OwnPrimarySelection()
void ScintillaGTK::ClaimSelection() {
// X Windows has a 'primary selection' as well as the clipboard.
// Whenever the user selects some text, we become the primary selection
- if (currentPos != anchor) {
+ if (currentPos != anchor &&
GTK_WIDGET_REALIZED(GTK_WIDGET(PWidget(wMain)))) {
primarySelection = true;
gtk_selection_owner_set(GTK_WIDGET(PWidget(wMain)),
GDK_SELECTION_PRIMARY,
GDK_CURRENT_TIME);
@@ -1491,6 +1502,7 @@ void ScintillaGTK::ReceivedSelection(Gtk
SetEmptySelection(currentPos + selText.len);
}
pdoc->EndUndoAction();
+ EnsureCaretVisible();
}
}
// else fprintf(stderr, "Target non string %d %d\n",
(int)(selection_data->type),
@@ -1506,9 +1518,12 @@ void ScintillaGTK::ReceivedDrop(GtkSelec
GetGtkSelectionText(selection_data, selText);
DropAt(posDrop, selText.s, false, selText.rectangular);
}
- } else {
- char *ptr = reinterpret_cast<char *>(selection_data->data);
- NotifyURIDropped(ptr);
+ } else if (selection_data->length > 0) {
+ char *ptr = new char[selection_data->length + 1];
+ ptr[selection_data->length] = '\0';
+ memcpy(ptr, selection_data->data, selection_data->length);
+ NotifyURIDropped(ptr);
+ delete []ptr;
}
Redraw();
}
_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest