forked from SublimeCodeIntel/SublimeCodeIntel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgtk.patch
More file actions
578 lines (541 loc) · 19.1 KB
/
Copy pathgtk.patch
File metadata and controls
578 lines (541 loc) · 19.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
Three parts to this patch:
1. General gtk patches
2. (from gtk_copy_crash_bug81293.patch):
Komodo was crashing at shutdown if the user performed a copy operation on a
Scintilla buffer before shutting down, bug 81293.
3. gtk-dragscroll.patch
--- gtk/ScintillaGTK.cxx 2007-10-12 15:09:56.000000000 -0700
+++ gtk/ScintillaGTK.cxx 2007-10-12 16:04:00.000000000 -0700
@@ -2,5 +2,11 @@
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
+
+
+// enable focus hack. // KOMODO
+#define KOMODO_NO_FOCUS // KOMODO
+#define KOMODO_DISABLE_DRAG_DROP // KOMODO
+
#include <new>
#include <stdlib.h>
@@ -99,6 +105,10 @@
extern char *UTF8FromLatin1(const char *s, int &len);
+#ifndef WM_UNICHAR
+#define WM_UNICHAR 0x0109
+#endif
+
class ScintillaGTK : public ScintillaBase {
_ScintillaObject *sci;
Window wText;
@@ -108,6 +118,8 @@
GtkAdjustment *adjustmenth;
int scrollBarWidth;
int scrollBarHeight;
+ // XXX ActiveState prevent recursive Resize
+ bool inResize;
// Because clipboard access is asynchronous, copyText is created by Copy
#ifndef USE_GTK_CLIPBOARD
@@ -175,6 +187,11 @@
public: // Public for scintilla_send_message
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
private:
+ // XXX ActiveState drag scroll support
+ int scrollSpeed;
+ int scrollTicks;
+ void DragScroll();
+
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
virtual void SetTicking(bool on);
virtual bool SetIdle(bool on);
@@ -205,8 +217,10 @@
virtual void ClaimSelection();
void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText);
void ReceivedSelection(GtkSelectionData *selection_data);
+#ifndef KOMODO_DISABLE_DRAG_DROP
void ReceivedDrop(GtkSelectionData *selection_data);
+#endif
static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *selected);
#ifdef USE_GTK_CLIPBOARD
void StoreOnClipboard(SelectionText *clipText);
static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data);
@@ -273,6 +287,7 @@
static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data,
guint info, guint time);
static gint SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event);
+#ifndef KOMODO_DISABLE_DRAG_DROP
static void DragBegin(GtkWidget *widget, GdkDragContext *context);
gboolean DragMotionThis(GdkDragContext *context, gint x, gint y, guint dragtime);
static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context,
@@ -286,7 +301,8 @@
gint x, gint y, GtkSelectionData *selection_data, guint info, guint time);
static void DragDataGet(GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data, guint info, guint time);
+#endif
static gboolean TimeOut(ScintillaGTK *sciThis);
static gboolean IdleCallback(ScintillaGTK *sciThis);
static gboolean StyleIdle(ScintillaGTK *sciThis);
virtual void QueueStyling(int upTo);
@@ -298,6 +314,10 @@
static sptr_t DirectFunction(ScintillaGTK *sciThis,
unsigned int iMessage, uptr_t wParam, sptr_t lParam);
+
+ // functions to localise the focus hacks a bit. // KOMODO
+ virtual void GrabFocus(); // KOMODO
+ virtual void ChangeFocusState(bool focus); // KOMODO
};
enum {
@@ -351,7 +371,8 @@
ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
adjustmentv(0), adjustmenth(0),
scrollBarWidth(30), scrollBarHeight(30),
+ inResize(false),
capturedMouse(false), dragWasDropped(false),
lastKey(0), rectangularSelectionModifier(SCMOD_CTRL), parentClass(0),
im_context(NULL),
lastWheelMouseDirection(0),
@@ -396,8 +416,32 @@
ScintillaGTK::~ScintillaGTK() {
g_idle_remove_by_data(this);
}
+// KOMODO HACK
+void
+ScintillaGTK::GrabFocus()
+{
+#ifdef KOMODO_NO_FOCUS
+ //SetFocusState(true);
+#else
+ gtk_widget_grab_focus(PWidget(wMain));
+#endif
+}
+
+// KOMODO HACK
+void
+ScintillaGTK::ChangeFocusState(bool focus)
+{
+#ifndef KOMODO_NO_FOCUS
+ if (focus)
+ GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_HAS_FOCUS);
+ else
+ GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_HAS_FOCUS);
+#endif
+ SetFocusState(focus);
+}
+
void ScintillaGTK::RealizeThis(GtkWidget *widget) {
//Platform::DebugPrintf("ScintillaGTK::realize this\n");
#if GTK_CHECK_VERSION(2,20,0)
gtk_widget_set_realized(widget, TRUE);
@@ -654,7 +698,10 @@
gint ScintillaGTK::FocusInThis(GtkWidget *widget) {
try {
- SetFocusState(true);
+ ScintillaGTK *sciThis = ScintillaFromWidget(widget);
+ sciThis->ChangeFocusState(true); // KOMODO INSTEAD OF FOLLOWING TWO LINES
+ //GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+ //SetFocusState(true);
if (im_context != NULL) {
gchar *str = NULL;
gint cursor_pos;
@@ -692,7 +738,10 @@
gint ScintillaGTK::FocusOutThis(GtkWidget *widget) {
try {
- SetFocusState(false);
+ ScintillaGTK *sciThis = ScintillaFromWidget(widget);
+ sciThis->ChangeFocusState(false); // KOMODO INSTEAD OF FOLLOWING TWO LINES
+ //GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
+ //SetFocusState(false);
if (PWidget(wPreedit) != NULL)
gtk_widget_hide(PWidget(wPreedit));
@@ -719,8 +767,13 @@
}
void ScintillaGTK::SizeRequest(GtkWidget *widget, GtkRequisition *requisition) {
ScintillaGTK *sciThis = ScintillaFromWidget(widget);
- requisition->width = 1;
+ // XXX ActiveState. We need to figure out if there is a way to
+ // initialize these values better. They cause problems with the initial
+ // scroll locations, and also are the cause of our flickering scrollbars
+ // when opening multiple files on startup. Increasing the width makes
+ // the scrollbar flicker go away. bug 29103
+ requisition->width = 2000;
requisition->height = 1;
GtkRequisition child_requisition;
#if GTK_CHECK_VERSION(3,0,0)
@@ -726,8 +815,10 @@
gtk_widget_set_can_focus(PWidget(wMain), TRUE);
gtk_widget_set_sensitive(PWidget(wMain), TRUE);
#else
+#ifndef KOMODO_NO_FOCUS
GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_CAN_FOCUS);
+#endif
GTK_WIDGET_SET_FLAGS(GTK_WIDGET(PWidget(wMain)), GTK_SENSITIVE);
#endif
gtk_widget_set_events(PWidget(wMain),
GDK_EXPOSURE_MASK
@@ -820,12 +875,14 @@
gtk_widget_set_parent(PWidget(scrollbarh), PWidget(wMain));
gtk_widget_show(PWidget(scrollbarh));
- gtk_widget_grab_focus(PWidget(wMain));
+ GrabFocus(); // KOMODO -- instead of following:
+ // gtk_widget_grab_focus(PWidget(wMain));
+#ifndef KOMODO_DISABLE_DRAG_DROP
gtk_drag_dest_set(GTK_WIDGET(PWidget(wMain)),
GTK_DEST_DEFAULT_ALL, clipboardPasteTargets, nClipboardPasteTargets,
static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE));
-
+#endif
// Set caret period based on GTK settings
gboolean blinkOn = false;
if (g_object_class_find_property(G_OBJECT_GET_CLASS(
@@ -880,6 +936,9 @@
void ScintillaGTK::StartDrag() {
dragWasDropped = false;
+#ifdef KOMODO_DISABLE_DRAG_DROP
+ inDragDrop = ddNone;
+#else
inDragDrop = ddDragging;
GtkTargetList *tl = gtk_target_list_new(clipboardCopyTargets, nClipboardCopyTargets);
gtk_drag_begin(GTK_WIDGET(PWidget(wMain)),
@@ -887,6 +946,7 @@
static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE),
evbtn.button,
reinterpret_cast<GdkEvent *>(&evbtn));
+#endif
}
static char *ConvertText(int *lenResult, char *s, size_t len, const char *charSetDest,
@@ -1014,7 +1074,8 @@
switch (iMessage) {
case SCI_GRABFOCUS:
- gtk_widget_grab_focus(PWidget(wMain));
+ GrabFocus(); // KOMODO HACK INSTEAD OF:
+ // gtk_widget_grab_focus(PWidget(wMain));
break;
case SCI_GETDIRECTFUNCTION:
@@ -1034,7 +1095,19 @@
case SCI_ENCODEDFROMUTF8:
return EncodedFromUTF8(reinterpret_cast<char*>(wParam),
reinterpret_cast<char*>(lParam));
-
+
+ case WM_UNICHAR:
+ if (IsUnicodeMode()) {
+ char utfval[4];
+ wchar_t wcs[2] = {static_cast<wchar_t>(wParam), 0};
+ unsigned int len = UTF8Length(wcs, 1);
+ UTF8FromUTF16(wcs, 1, utfval, len);
+ AddCharUTF(utfval, len);
+ return 1;
+ } else {
+ return 0;
+ }
+
case SCI_SETRECTANGULARSELECTIONMODIFIER:
rectangularSelectionModifier = wParam;
break;
@@ -1108,6 +1183,41 @@
paintState = notPainting;
}
+void ScintillaGTK::DragScroll() {
+#define RESET_SCROLL_TIMER(lines) \
+ scrollSpeed = (lines); \
+ scrollTicks = 2000;
+
+ if (!posDrag.IsValid()) {
+ RESET_SCROLL_TIMER(1);
+ return;
+ }
+ int posDragPosition = posDrag.Position();
+ Point dragMouse = LocationFromPosition(posDragPosition);
+ int line = pdoc->LineFromPosition(posDragPosition);
+ int currentVisibleLine = cs.DisplayFromDoc(line);
+ int lastVisibleLine = Platform::Minimum(topLine + LinesOnScreen() - 1, pdoc->LinesTotal() - 1);
+
+ if (currentVisibleLine <= topLine && topLine > 0) {
+ ScrollTo( topLine - scrollSpeed );
+ } else if (currentVisibleLine >= lastVisibleLine) {
+ ScrollTo( topLine + scrollSpeed );
+ } else {
+ RESET_SCROLL_TIMER(1);
+ return;
+ }
+ if (scrollSpeed == 1) {
+ scrollTicks -= timer.tickSize;
+ if (scrollTicks <= 0) {
+ RESET_SCROLL_TIMER(5);
+ }
+ }
+
+ SetDragPosition(SelectionPosition(PositionFromLocation(dragMouse)));//QQQ
+
+#undef RESET_SCROLL_TIMER
+}
+
void ScintillaGTK::ScrollText(int linesToMove) {
int diff = vs.lineHeight * -linesToMove;
//Platform::DebugPrintf("ScintillaGTK::ScrollText %d %d %0d,%0d %0d,%0d\n", linesToMove, diff,
@@ -1339,7 +1412,7 @@
int ScintillaGTK::KeyDefault(int key, int modifiers) {
if (!(modifiers & SCI_CTRL) && !(modifiers & SCI_ALT)) {
if (key < 256) {
- NotifyKey(key, modifiers);
+ AddChar(key);
return 0;
} else {
// Pass up to container in case it is an accelerator
@@ -1470,6 +1543,118 @@
static GdkAtom TypeOfGSD(GtkSelectionData *sd) { return sd->type; }
static GdkAtom SelectionOfGSD(GtkSelectionData *sd) { return sd->selection; }
#endif
+
+
+/* SMC UTF-8 detection code below taken from Apache mod_fileiri */
+
+/*
+ * UTF-8 lead byte enum and table for tight checking
+ * (all this utf-8 stuff probably should go into some library)
+ */
+
+typedef enum {
+ end, /* end of string */
+ ill, /* illegal byte */
+ asc, /* us-ascii */
+ trl, /* trailing */
+ by2, /* two bytes */
+ e0, /* three bytes, e0 lead byte */
+ by3, /* three bytes, normal case */
+ ed, /* three bytes, ed lead byte */
+ p13, /* four bytes, planes 1-3 */
+ by4, /* four bytes, normal case (planes 4-15) */
+ p16 /* four bytes, plane 16 */
+} utf8lead;
+
+static utf8lead UTF8lead[256] = {
+ /* should all control codes be illegal? or allowed? */
+ /* never make 0x00 legal, code depends on it being illegal */
+ /* 0x00 */ end, ill, ill, ill, ill, ill, ill, ill,
+ /* 0x08 */ ill, asc, asc, ill, ill, asc, ill, ill,
+ /* 0x10 */ ill, ill, ill, ill, ill, ill, ill, ill,
+ /* 0x18 */ ill, ill, ill, ill, ill, ill, ill, ill,
+ /* 0x20 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x28 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x30 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x38 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x40 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x48 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x50 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x58 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x60 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x68 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x70 */ asc, asc, asc, asc, asc, asc, asc, asc,
+ /* 0x78 */ asc, asc, asc, asc, asc, asc, asc, ill,
+ /* 0x80 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0x88 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0x90 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0x98 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0xA0 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0xA8 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0xB0 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0xB8 */ trl, trl, trl, trl, trl, trl, trl, trl,
+ /* 0xC0 */ ill, ill, by2, by2, by2, by2, by2, by2,
+ /* 0xC8 */ by2, by2, by2, by2, by2, by2, by2, by2,
+ /* 0xD0 */ by2, by2, by2, by2, by2, by2, by2, by2,
+ /* 0xD8 */ by2, by2, by2, by2, by2, by2, by2, by2,
+ /* 0xE0 */ e0, by3, by3, by3, by3, by3, by3, by3,
+ /* 0xE8 */ by3, by3, by3, by3, by3, ed, by3, by3,
+ /* 0xF0 */ p13, by4, by4, by4, p16, ill, ill, ill,
+ /* 0x18 */ ill, ill, ill, ill, ill, ill, ill, ill,
+};
+
+
+static int isUTF8 (unsigned char *data, int len)
+{
+ /* figure out whether the input is UTF-8 */
+ unsigned char *p = data;
+ while (p - data < len) {
+ switch (UTF8lead[*p++]) {
+ case end:
+ return 1; /* clean end */
+ case ill:
+ case trl:
+ return 0;
+ case asc:
+ break;
+ case by2:
+ if (UTF8lead[*p++]!=trl)
+ return 0;
+ break;
+ case e0 :
+ if ((((*p++)&0xE0)!=0xA0) || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ case by3:
+ if ((UTF8lead[*p++]!=trl) || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ case ed :
+ if ((((*p++)&0xE0)!=0x80) || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ case p13:
+ if (((*p)<0x90 || 0xBF<(*p++))
+ || (UTF8lead[*p++]!=trl)
+ || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ case by4:
+ if ((UTF8lead[*p++]!=trl)
+ || (UTF8lead[*p++]!=trl)
+ || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ case p16:
+ if ((((*p++)&0xF0)!=0x80)
+ || (UTF8lead[*p++]!=trl)
+ || (UTF8lead[*p++]!=trl))
+ return 0;
+ break;
+ }
+ }
+ return 0;
+}
// Detect rectangular text, convert line ends to current mode, convert from or to UTF-8
void ScintillaGTK::GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText) {
@@ -1496,7 +1681,7 @@
char *dest;
if (selectionTypeData == GDK_TARGET_STRING) {
dest = Document::TransformLineEnds(&len, data, len, pdoc->eolMode);
- if (IsUnicodeMode()) {
+ if (IsUnicodeMode() && !isUTF8((unsigned char *)dest, len)) {
// Unknown encoding so assume in Latin1
char *destPrevious = dest;
dest = UTF8FromLatin1(dest, len);
@@ -1545,8 +1771,12 @@
sel.Range(sel.Main()).Start();
if (selText.rectangular) {
- PasteRectangular(selStart, selText.s, selText.len);
+ PasteRectangular(selStart.Position(), selText.s, selText.len);
} else {
InsertPaste(selStart, selText.s, selText.len);
+ // XXX ActiveState bug 33804
+ if (ac.Active()) {
+ AutoCompleteMoveToCurrentWord();
+ }
}
EnsureCaretVisible();
@@ -1563,6 +1752,7 @@
}
}
+#ifndef KOMODO_DISABLE_DRAG_DROP
void ScintillaGTK::ReceivedDrop(GtkSelectionData *selection_data) {
dragWasDropped = true;
if (TypeOfGSD(selection_data) == atomUriList || TypeOfGSD(selection_data) == atomDROPFILES_DND) {
@@ -1582,7 +1772,7 @@
}
Redraw();
}
-
+#endif
void ScintillaGTK::GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text) {
@@ -1707,10 +1938,15 @@
if (clipBoard == NULL) // Occurs if widget isn't in a toplevel
return;
- if (gtk_clipboard_set_with_data(clipBoard, clipboardCopyTargets, nClipboardCopyTargets,
- ClipboardGetSelection, ClipboardClearSelection, clipText)) {
- gtk_clipboard_set_can_store(clipBoard, clipboardCopyTargets, nClipboardCopyTargets);
- }
+ // "gtk_clipboard_set_with_data" is not used by Komodo as it is causing
+ // a crash upon shutdown, see bug 81293. The "gtk_clipboard_set_text"
+ // can result in more memory getting used (in the case where a copy is
+ // never pasted).
+ gtk_clipboard_set_text(clipBoard, clipText->s, clipText->len);
+ //if (gtk_clipboard_set_with_data(clipBoard, clipboardCopyTargets, nClipboardCopyTargets,
+ // ClipboardGetSelection, ClipboardClearSelection, clipText)) {
+ // gtk_clipboard_set_can_store(clipBoard, clipboardCopyTargets, nClipboardCopyTargets);
+ //}
}
void ScintillaGTK::ClipboardGetSelection(GtkClipboard *, GtkSelectionData *selection_data, guint info, void *data) {
@@ -1742,8 +1932,10 @@
void ScintillaGTK::Resize(int width, int height) {
//Platform::DebugPrintf("Resize %d %d\n", width, height);
//printf("Resize %d %d\n", width, height);
-
+ // XXX ActiveState prevent recursive Resize
+ if (inResize) return;
+ inResize = true;
// Not always needed, but some themes can have different sizes of scrollbars
#if GTK_CHECK_VERSION(3,0,0)
GtkRequisition requisition;
gtk_widget_get_requisition(PWidget(scrollbarv), &requisition);
@@ -1794,6 +1986,9 @@
if (!verticalScrollBarVisible)
alloc.width += scrollBarWidth;
gtk_widget_size_allocate(GTK_WIDGET(PWidget(wText)), &alloc);
+
+ // XXX ActiveState prevent recursive Resize
+ inResize = false;
}
static void SetAdjustmentValue(GtkAdjustment *object, int value) {
@@ -1843,7 +2042,8 @@
bool ctrl = (event->state & GDK_CONTROL_MASK) != 0;
- gtk_widget_grab_focus(PWidget(wMain));
+ GrabFocus(); // KOMODO HACK instead of:
+ // gtk_widget_grab_focus(PWidget(wMain));
if (event->button == 1) {
// On X, instead of sending literal modifiers use the user specified
// modifier, defaulting to control instead of alt.
@@ -1890,7 +2090,7 @@
} catch (...) {
errorStatus = SC_STATUS_FAILURE;
}
- return TRUE;
+ return FALSE; /* ACTIVESTATE, must return false to let even through to mozilla */
}
gint ScintillaGTK::Press(GtkWidget *widget, GdkEventButton *event) {
@@ -2521,6 +2721,7 @@
return TRUE;
}
+#ifndef KOMODO_DISABLE_DRAG_DROP
void ScintillaGTK::DragBegin(GtkWidget *, GdkDragContext *) {
//Platform::DebugPrintf("DragBegin\n");
}
@@ -2625,9 +2873,11 @@
sciThis->errorStatus = SC_STATUS_FAILURE;
}
}
+#endif
int ScintillaGTK::TimeOut(ScintillaGTK *sciThis) {
sciThis->Tick();
+ sciThis->DragScroll();
return 1;
}
@@ -2802,13 +3004,21 @@
widget_class->selection_get = SelectionGet;
widget_class->selection_clear_event = SelectionClear;
+#ifdef KOMODO_DISABLE_DRAG_DROP
+ widget_class->drag_data_received = NULL;
+ widget_class->drag_motion = NULL;
+ widget_class->drag_leave = NULL;
+ widget_class->drag_end = NULL;
+ widget_class->drag_drop = NULL;
+ widget_class->drag_data_get = NULL;
+#else
widget_class->drag_data_received = DragDataReceived;
widget_class->drag_motion = DragMotion;
widget_class->drag_leave = DragLeave;
widget_class->drag_end = DragEnd;
widget_class->drag_drop = Drop;
widget_class->drag_data_get = DragDataGet;
-
+#endif
widget_class->realize = Realize;
widget_class->unrealize = UnRealize;
widget_class->map = Map;
@@ -2888,8 +3099,10 @@
#if GTK_CHECK_VERSION(2,20,0)
gtk_widget_set_can_focus(GTK_WIDGET(sci), TRUE);
#else
+#ifndef KOMODO_NO_FOCUS
GTK_WIDGET_SET_FLAGS(sci, GTK_CAN_FOCUS);
+#endif
#endif
sci->pscin = new ScintillaGTK(sci);
} catch (...) {
}