Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 28 Jul 2016, 14:33
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GTK selection bugs
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1031
Location: Japan

PostPosted: Mon 13 Jun 2016, 03:43    Post subject:  GTK selection bugs  

Left click bug
After shutting down parcellite I noticed that something is wrong with middle mouse button pasting. It turned out that this is what someone described as the Left-click clears PRIMARY buffer bug. I checked with the newest tahrpup. The bug is still there. Most users will not notice as the presence of a clipboard manager like parcellite or clipit miraculously "fixes" the bug. Anyway, it's a bug I can live with.

Variable bug
This is more serious and haven't found a cure or work around. I would be grateful for any help.

The problem arises when assigning a selection to a variable or directly to a widget. Something like
SELECTION=$(xclip -o) will assign the contents of the X selection (PRIMARY) buffer to the variable SELECTION. Used in a Gtkdialog code this works as expected after the user made a selection in a different window. Gtkdialog will then put the selection content into the variable SELECTION. However this does not work and causes Gtkdialog to freeze when the selection was made in the Gtkdialog window itself. Apparently this is not a xclip bug because it also happens with similar selection tools like xsel.

To confirm, that this is a GTK bug and not a Gtkdialog bug I checked with my recent YAD form demo code. When a user selects files in ROX-Filer and then pushes the "Refresh file list" button", the file names will appear in the form. When the user selects something else , e.g. text in a Geany window and then pushes the button,YAD will show an info text. However when the user selects something in the YAD form and then pushes the button, YAD will freeze (to test this, run the code from a console because it will not be possible anymore to close the YAD window. Close the console instead).

The same thing happens in Gtkdialog. Below a small example, this time using the clipboard (and for obvious reasons executed in a console window Wink ). Copy some text in a different window and then push the "Paste" button. Should work without problems. Copying something from the dialog and pasting it to a different window will also work, but pushing the "Paste" button will make the dialog unresponsive. Any idea how I can prevent this?

Edit1: I was hoping that writing the selection/clipboard content to a file and then reading the file would prevent the bug, but this doesn't work. Already the attempt to write the X selection to a file (command: xclip -o > file) will trigger the bug.

Edit2: Writing the selection/clipboard content to a file and then reading the file can indeed be used as a work around if the xclip command is executed in a separate console window. This window may still freeze, but killing the window can be automated and at least the main dialog stays alive. Not a great solution, but it works.

Code:
#!/bin/bash
echo -n '' | xclip   -selection clipboard   # clear clipboard
urxvt -e bash -c "echo -n '<window>
<vbox>
   <text label=\"Content of clipboard:\" selectable=\"true\"></text>
   <entry>
      <input>xclip -o   -selection clipboard</input>
      <variable>vENTRY</variable>
   </entry>
   <button has-focus=\"true\" label=\"Paste from clipboard\">
      <action>refresh:vENTRY</action>
   </button>
   <button cancel></button>
</vbox>
</window>'|gtkdialog -s"
clipboard_test.png
 Description   
 Filesize   4.46 KB
 Viewed   246 Time(s)

clipboard_test.png


Last edited by MochiMoppel on Tue 14 Jun 2016, 21:53; edited 2 times in total
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8519
Location: qld

PostPosted: Mon 13 Jun 2016, 05:36    Post subject:  

I can confirm the 'variable' bug in slacko-630

While it is certainly possible that this is a gtk/gdk (or even glib) bug it is also entirely possible that this is an xlib bug.

After all, copying to the clipboard is an x-server task.

I've no idea where to start looking! It would be nice if we could confirm the bug in the qt or even the fltk toolkits. That would certainly narrow it down.

EDIT: I can confirm it bugs out with gtk+-3.0 as well.

_________________
Puppy Linux Blog - contact me for access

Last edited by 01micko on Mon 13 Jun 2016, 17:45; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 320

PostPosted: Mon 13 Jun 2016, 12:58    Post subject: Re: GTK selection bugs  

MochiMoppel wrote:
Left click bug
After shutting down parcellite I noticed that something is wrong with middle mouse button pasting. It turned out that this is what someone described as the Left-click clears PRIMARY buffer bug. I checked with the newest tahrpup. The bug is still there. Most users will not notice as the presence of a clipboard manager like parcellite or clipit miraculously "fixes" the bug. Anyway, it's a bug I can live with.

I don't know if this is related, but sometimes when I copy stuff with right-click copy or Ctrl-C (into parcellite I guess?) it works when I paste it, and sometimes it doesn't work at all, like I never even copied it in the first place. The times when it works or doesn't seem to be random, and doing it again to same block of text sometimes works when it didn't the last time - lol. I know these things are never random and there is always a source of the problem though, maybe I'll read your buffer link in a bit.
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1031
Location: Japan

PostPosted: Tue 14 Jun 2016, 19:42    Post subject:  

01micko wrote:
I can confirm the 'variable' bug in slacko-630
Hmm...with what did you confirm? I tried 630 but couldn't find xclip or any replacement. Did you remove it on purpose?
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 8519
Location: qld

PostPosted: Wed 15 Jun 2016, 03:41    Post subject:  

MochiMoppel wrote:
01micko wrote:
I can confirm the 'variable' bug in slacko-630
Hmm...with what did you confirm? I tried 630 but couldn't find xclip or any replacement. Did you remove it on purpose?


Hmm.. it _may_ have been left out inadvertently Embarassed but it is in subsequent beta releases (running slacko64-6.3.0.3 right now). Nevertheless, the bug shows its face. I'm still wondering if it's an xlib bug.

_________________
Puppy Linux Blog - contact me for access
Back to top
View user's profile Send private message Visit poster's website 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1031
Location: Japan

PostPosted: Thu 16 Jun 2016, 22:51    Post subject:  

01micko wrote:
it _may_ have been left out inadvertently
I'm relieved Laughing
It seems that it never worked right. Checked with Puppy4.2 where the bug behaved less mean: xclip -o returns an empty string, but otherwise the dialog stays alive and can be shut normally. But there is another show stopper: xclip -o works only once. It returns the selection made outside the current window, and it returns an empty string for the selection made inside the current window, but that's it. Even when selections are changed, xclip -o would return whatever it returned the first time. It is as if GTK had saved the primary selection. Very strange. While this is going on, xclip keeps working normally in a console window.
Back to top
View user's profile Send private message 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 320

PostPosted: Tue 28 Jun 2016, 08:08    Post subject: Re: GTK selection bugs  

Thought I fixed the "copy buffer disappearing" by disabling Parcellite but it can happen either way (with it on or off). Meh.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1013s ][ Queries: 12 (0.0077s) ][ GZIP on ]