[Gambas-user] middle mouse paste

Bruce Steers bsteers4 at gmail.com
Tue Dec 27 19:57:50 CET 2022


On Tue, 27 Dec 2022 at 17:29, Benoit Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Le 27/12/2022 à 18:13, Bruce Steers a écrit :
> > Having problems with gambas doing middle mouse click pasting text !
> > It's really annoying as my mouse is a bit rubbish and i keep
> > accidentally pasting text as i'm scrolling with the wheel and messed
> > some code up a few times.
> >
> > I disabled the feature on my mate desktop settings and now it does not
> > happen on things like pluma or mate terminal but it's still happening in
> > the IDE.
> >
> > Okay i just checked the code and it seems yes ,
> > TextEditor.class / View_MouseUp() pastes text if middle mouse.
> >
> > I added a fix in my scripted editor I override the View_MouseUp() method
> > like this..
> >
> > Public Sub View_MouseUp()
> >
> >    If Mouse.Middle And If Not Me.ReadOnly And If Not $bMiddleMousePaste
> Then
> >      Me.ReadOnly = True
> >      Super.View_MouseUp
> >      Me.ReadOnly = False
> >    Else
> >      Super.View_MouseUp
> >    Endif
> >
> > End
> >
> > So if middle mouse is clicked and doc is not readonly and my
> > MiddleMousePaste property is false it sets readonly property to true
> > then fires the super mouseup event then sets readonly to false again.
> >
> > That seemed the best way to override in an automatically inherited
> > TextEditor.class in my own application but it would be great if we could
> > get a simple property like that for TextEditor.class Ben, to disable
> > middle mouse paste.
> > (and a toggle for it in the IDE editor prefs)
> >
> > Respects
> > BruceS
> >
> >
> >
> > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
> It should be a global desktop configuration...
>

Not so sure if it's global. could be independent in different desktops.
i couldn't find any changes using gsettings monitor on various schemas
while changing the option in mate settings.

But Gambas does not check anything at present.
This is current TextEditor mouse up event..

Public Sub View_MouseUp()

  If $hTimerScroll Then
    $hTimerScroll.Stop
    $hTimerScroll = Null
  Endif

  If Mouse.Middle And If Not $bReadOnly Then
    Clipboard.Current = Clipboard.Selection
    Paste
    Clipboard.Current = Clipboard.Default
  Endif

  $bMouseDown = False

End

So it pastes regardless of any desktop settings.
I've added an option in my ide for now as it is infuriating.
https://gitlab.com/bsteers4/gambas/-/commit/576e0d8ada2264fec19754d85e5db58784b58144
(plus the next commit to fix accidentally modified code)

Respects
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221227/5d7e4fad/attachment.htm>


More information about the User mailing list