Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11: Clipboard API needs a window #2062

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

X11: Clipboard API needs a window #2062

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.4
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2016-01-04 18:48:35 +0000, Imants wrote:

I am using libSDL2-2.0.so.0.4.0 witch I have compiled myself. When I try to get clipboard text or try to check if there is clipboard text my application gangs and stop responding indefinitely.

code example:

SDL_SetClipboardText('Test');
AssertTrue('SDL_HasClipboardText', SDL_HasClipboardText() = SDL_TRUE);
AssertEquals('Test', SDL_GetClipboardText());

On 2016-01-04 19:35:41 +0000, Imants wrote:

I tried same in CodeBlocks result was little different but failure still

SDL_SetClipboardText("SDL Tutorial");
int rez = SDL_HasClipboardText(); //rez was 0
if (rez)
{
title = SDL_GetClipboardText();
}
else
{
title = "fail"; //got this value
}

On 2016-01-05 18:01:51 +0000, Imants wrote:

I was idiot and forgot to call SDL_Init(SDL_INIT_EVERYTHING) in code blocks. After that application crashed as in my pascal code.

On 2016-01-06 06:45:37 +0000, Ryan C. Gordon wrote:

Created attachment 2355
Test program

Can you try this test program and see if it still has problems? It'll create a window, print what's currently on the clipboard to stdout, and then put whatever you had on the command line on the clipboard (which you can see by pasting it somewhere). The otherwise-useless SDL window will hang around until you close it to end the program.

Just trying to narrow down the problem here.

--ryan.

On 2016-01-06 18:29:18 +0000, Imants wrote:

Ok now I understand. On Linux SDL_HasClipboardText and SDL_GetClipboardText crashes if I call them before I create SDL_window or do not create it at all. On Windows it works properly in bought cases. I do not see why should I create SDL_Window to use clipboard functionality but I do know that It should not crash system :). And there is no documentation that this should work together with SDL_Window :\

On 2016-01-06 19:33:34 +0000, Ryan C. Gordon wrote:

(In reply to Imants from comment # 4)

Ok now I understand. On Linux SDL_HasClipboardText and SDL_GetClipboardText
crashes if I call them before I create SDL_window or do not create it at
all. On Windows it works properly in bought cases. I do not see why should I
create SDL_Window to use clipboard functionality but I do know that It
should not crash system :). And there is no documentation that this should
work together with SDL_Window :\

Yeah, X11 requires a window for this. But we could handle this better (maybe making a temporary window, or at least not crashing).

I'll leave this open for now while we figure out what to do.

--ryan.

On 2016-01-07 06:14:31 +0000, Imants wrote:

I would be contented if it would be mentioned in documentation, it would not crash and SDL_GetError() would return error message why it is not working.

On 2017-07-31 03:24:00 +0000, Ryan C. Gordon wrote:

*** Bug 3718 has been marked as a duplicate of this bug. ***

On 2017-08-02 14:21:34 +0000, Ryan C. Gordon wrote:

This bug is now fixed in https://hg.libsdl.org/SDL/rev/3767cdd2d64b ...we had already fixed the crashing if SDL_Init(SDL_INIT_VIDEO) wasn't called, but now you don't need to have created an SDL_Window to interact with the X11 clipboard.

--ryan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant