Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2016-08

Cut, Copy, Paste shortcuts don't work in SynEdit

7 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

I'm using the TypeMatrix 2030 USB keyboard (Dvorak layout). The TypeMatrix keyboard has special clipboard shortcuts via Fn functionality for Cut, Copy and Paste.

I'm using FreeBSD running JWM (a plain window manager). The issue is observed under Linux (Centos 6) too. All X11 applications work fine with the Fn clipboard functions - that's all except Lazarus IDE and I can't figure out why.

When I press the special Fn clipboard keys, it actually generates the IBM style Cut, Copy and Paste via Shift+Del, Ctrl+Ins and Shift+Ins respectively. The "xev" output shows that - below it generate the key sequence for Cut.

Because I use the Dvorak layout, I've always used the IBM style Cut, Copy and Paste because it is easier to type. I've also set up Lazarus IDE with secondary shortcuts for those. When I physically press Shift+Del it works, but the Fn+Cut key doesn't. Yet they generate the exact same key sequences in xev.

Anybody got any idea why Lazarus IDE (more specifically SynEdit) doesn't work correctly?

NOTE:
Any dialogs in Lazarus IDE that accepts text, the Fn clipboard functionality works (eg: a TEdit). So LCL is not the problem. It seems on SynEdit is the issue.

If I press Fn+Cut on my TypeMatrix 2030, this is what xev outputs:

================[ xev output ]==================== KeyPress event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False

KeyPress event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), state 0x1, keycode 107 (keysym 0xffff, Delete), same_screen YES, XLookupString gives 1 bytes: (7f) ""
XmbLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes:
XFilterEvent returns: False

KeyRelease event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), state 0x0, keycode 107 (keysym 0xffff, Delete), same_screen YES, XLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False
===========================================

I haven't tested under Windows yet.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp -------------- next part -------------- A non-text attachment was scrubbed... Name: Screenshot.png Type: image/png Size: 23135 bytes Desc: not available URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160812/631e054e/attachment-0001.png>

Reply by email

Martin Frb
to Graeme Geldenhuys

the patch here might help, but might cause new issues (so I was told / I remember some discussion on the topic, but I cant find it) (It is very old, not sure if the issue is still the same)

The issue is that the "time" in the events for different keys is the same. Apparently that means it is one event only (again Ive been told, I never looked at the gtk spec)

The LCL filters by that time.

the patch adds the key itself to the filter.
But if you take a key that is currently handled correctly, and where the "key" value is changed by a handler, then the patch will lead to that stroke being duplicated (or maybe duplicated...) (again so I was told)

Graeme Geldenhuys wrote 67 lines
I'm using the TypeMatrix 2030 USB keyboard (Dvorak layout). The TypeMatrix keyboard has special clipboard shortcuts via Fn functionality for Cut, Copy and Paste. I'm using FreeBSD running JWM (a plain window manager). The issue is observed under Linux (Centos 6) too. All X11 applications work fine with the Fn clipboard functions - that's all except Lazarus IDE and I can't figure out why. When I press the special Fn clipboard keys, it actually generates the IBM style Cut, Copy and Paste via Shift+Del, Ctrl+Ins and Shift+Ins respectively. The "xev" output shows that - below it generate the key sequence for Cut. Because I use the Dvorak layout, I've always used the IBM style Cut, Copy and Paste because it is easier to type. I've also set up Lazarus IDE with secondary shortcuts for those. When I physically press Shift+Del it works, but the Fn+Cut key doesn't. Yet they generate the exact same key sequences in xev. Anybody got any idea why Lazarus IDE (more specifically SynEdit) doesn't work correctly? NOTE: Any dialogs in Lazarus IDE that accepts text, the Fn clipboard functionality works (eg: a TEdit). So LCL is not the problem. It seems on SynEdit is the issue. If I press Fn+Cut on my TypeMatrix 2030, this is what xev outputs: ================[ xev output ]==================== KeyPress event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XmbLookupString gives 0 bytes: XFilterEvent returns: False KeyPress event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), state 0x1, keycode 107 (keysym 0xffff, Delete), same_screen YES, XLookupString gives 1 bytes: (7f) "" XmbLookupString gives 1 bytes: (7f) "" XFilterEvent returns: False KeyRelease event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, XLookupString gives 0 bytes: XFilterEvent returns: False KeyRelease event, serial 36, synthetic NO, window 0x2600001, root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), state 0x0, keycode 107 (keysym 0xffff, Delete), same_screen YES, XLookupString gives 1 bytes: (7f) "" XFilterEvent returns: False =========================================== I haven't tested under Windows yet. Regards, Graeme

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160812/da862648/attachment.html>

Reply by email

Martin Frb
to Martin Frb

sorry, I simply forgot to paste.....

Martin Frb wrote
the patch here

http://bugs.freepascal.org/view.php?id=14716

Show quoted text 90 lines
might help, but might cause new issues (so I was told / I remember some discussion on the topic, but I cant find it) (It is very old, not sure if the issue is still the same) The issue is that the "time" in the events for different keys is the same. Apparently that means it is one event only (again Ive been told, I never looked at the gtk spec) The LCL filters by that time. the patch adds the key itself to the filter. But if you take a key that is currently handled correctly, and where the "key" value is changed by a handler, then the patch will lead to that stroke being duplicated (or maybe duplicated...) (again so I was told) On 12/08/2016 10:31, Graeme Geldenhuys wrote: > I'm using the TypeMatrix 2030 USB keyboard (Dvorak layout). The > TypeMatrix keyboard has special clipboard shortcuts via Fn functionality > for Cut, Copy and Paste. > > I'm using FreeBSD running JWM (a plain window manager). The issue is > observed under Linux (Centos 6) too. All X11 applications work fine with > the Fn clipboard functions - that's all except Lazarus IDE and I can't > figure out why. > > When I press the special Fn clipboard keys, it actually generates the > IBM style Cut, Copy and Paste via Shift+Del, Ctrl+Ins and Shift+Ins > respectively. The "xev" output shows that - below it generate the key > sequence for Cut. > > Because I use the Dvorak layout, I've always used the IBM style Cut, > Copy and Paste because it is easier to type. I've also set up Lazarus > IDE with secondary shortcuts for those. When I physically press > Shift+Del it works, but the Fn+Cut key doesn't. Yet they generate the > exact same key sequences in xev. > > Anybody got any idea why Lazarus IDE (more specifically SynEdit) doesn't > work correctly? > > NOTE: > Any dialogs in Lazarus IDE that accepts text, the Fn clipboard > functionality works (eg: a TEdit). So LCL is not the problem. > It seems on SynEdit is the issue. > > > If I press Fn+Cut on my TypeMatrix 2030, this is what xev outputs: > > ================[ xev output ]==================== > KeyPress event, serial 36, synthetic NO, window 0x2600001, > root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), > state 0x0, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, > XLookupString gives 0 bytes: > XmbLookupString gives 0 bytes: > XFilterEvent returns: False > > KeyPress event, serial 36, synthetic NO, window 0x2600001, > root 0x295, subw 0x0, time 175828944, (1760,391), root:(1939,589), > state 0x1, keycode 107 (keysym 0xffff, Delete), same_screen YES, > XLookupString gives 1 bytes: (7f) "" > XmbLookupString gives 1 bytes: (7f) "" > XFilterEvent returns: False > > KeyRelease event, serial 36, synthetic NO, window 0x2600001, > root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), > state 0x1, keycode 50 (keysym 0xffe1, Shift_L), same_screen YES, > XLookupString gives 0 bytes: > XFilterEvent returns: False > > KeyRelease event, serial 36, synthetic NO, window 0x2600001, > root 0x295, subw 0x0, time 175829000, (1760,391), root:(1939,589), > state 0x0, keycode 107 (keysym 0xffff, Delete), same_screen YES, > XLookupString gives 1 bytes: (7f) "" > XFilterEvent returns: False > =========================================== > > > I haven't tested under Windows yet. > > Regards, > Graeme > > >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160812/c856c727/attachment.html>

Reply by email

Graeme Geldenhuys
to Martin Frb: the patch here might help, but might cause new issues (so I was told / I remember some…
Martin Frb wrote 5 lines
The issue is that the "time" in the events for different keys is the same. Apparently that means it is one event only (again Ive been told, I never looked at the gtk spec) The LCL filters by that time.

But wouldn’t that suggest that the whole of LCL (including TEdit, TMemo) would have that issue? With my testing, it is only SynEdit that has a problem. TEdit & TMemo works just fine with TM2030's hardware clipboard keys.

Either way, many thanks for the link to the bug tracker. I'll give that patch a try and report back.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 11 lines
On 2016-08-12 10:56, Martin Frb wrote: > The issue is that the "time" in the events for different keys is the > same. Apparently that means it is one event only (again Ive been told, I > never looked at the gtk spec) > > The LCL filters by that time. But wouldn’t that suggest that the whole of LCL (including TEdit, TMemo) would have that issue? With my testing, it is only SynEdit that has a problem. TEdit & TMemo works just fine with TM2030's hardware clipboard keys.

Martin meant the LCL custom control filters.
TEdit and TMemo are native controls, so their keys are handled mostly by the widgetset itself.
SynEdit is a custom control, so the LCL and SynEdit has to handle the composed/compound keys. I guess the problem lies in the LCL gtk2 interface.

Either way, many thanks for the link to the bug tracker. I'll give that patch a try and report back.

Mattias

Reply by email

Graeme Geldenhuys
to Martin Frb: sorry, I simply forgot to paste..... http://bugs.freepascal.org/view.php?id=14716…
Martin Frb wrote
On 12/08/2016 10:56, Martin Frb wrote: > > the patch here http://bugs.freepascal.org/view.php?id=14716

The original patch mentioned was for GTK1 (or at the time when GTK2 shared GTK1 code). I created a new LCL-GTK2 patch and now SynEdit works correctly with the hardware clipboard keys.

I made some comments to the bug report (regarding OnKeyPress) and attached a new patch. Many thanks for your quick response.

ps:
This issue might pop up more frequent with newer keyboards flooding the market where many (eg: the Ergodox EZ) support fully programmable key layouts, including one button macros.

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp

Reply by email