Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Window resizing + Qt  (Read 3635 times)

0 Members and 1 Guest are viewing this topic.

Cide

  • Newbie
  • *
  • Posts: 3
    • View Profile
Window resizing + Qt
« on: March 09, 2012, 02:51:01 pm »
So I have been trying to research a bug for a while now. This is on SFML2, pretty recently pulled from Github.

 While using an SFML canvas with Qt (on Linux/X11) and resizing the canvas to be larger, it appears that WindowImplX11 does not actually receive any XEvents (or at least not ConfigureNotify) during its event processing. From what I can tell this is because Qt is handling the events before SFML polls for them. This manifests itself mostly in the fact that the internal window size is never updated which means that calls to SetSize() are totally useless. As such, we cannot update the back buffer and the increase in window size just leads to a black (or whatever your Clear() color is) area on the screen.

I have been researching solutions to this but I haven't been able to come up with a good one.  The way the Window/RenderWindow interface is structured makes it pretty difficult to access the window implementation (not to mention that WindowImplX11 is not accessible through header includes unless you add the SFML source files to your search path), and even with access to WindowImplX11 SFML2 currently does not expose ProcessEvent() to the public.

I could probably hack together a solution that would solve my issues, but it seems like this should be something that should be fixed in SFML2. Well, not really fixed, since it's Qt that is stealing events from SFML, but at least expose a way to handle this. I can receive XEvents to the QSFMLCanvas class (as per the Qt+SFML tutorial) with QWidget::x11Event(XEvent*), but there is no good way for them to reach WindowImplX11 at the moment. Any ideas?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window resizing + Qt
« Reply #1 on: March 10, 2012, 05:36:01 pm »
Yep, it definitely needs to be fixed.

Can you write a complete and minimal example that reproduces the problem, and post an issue to the bug tracker?

Thanks for your feedback :)
Laurent Gomila - SFML developer

Cide

  • Newbie
  • *
  • Posts: 3
    • View Profile
Window resizing + Qt
« Reply #2 on: March 12, 2012, 01:35:54 pm »
I actually pulled the most recent version off GitHub and it worked. I'm in the process of figuring out if this bug is still relevant and if so, what changed.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Window resizing + Qt
« Reply #3 on: March 12, 2012, 01:50:10 pm »
How old was your previous version of SFML 2? I don't think that I changed anything in the window module recently.
Laurent Gomila - SFML developer

Cide

  • Newbie
  • *
  • Posts: 3
    • View Profile
Window resizing + Qt
« Reply #4 on: March 16, 2012, 06:00:37 pm »
It wasn't more than 2 months old I'd say, but I can't say for sure (I switched Linux distributions recently so I lost my history). It's still on my to-do list to check what's up with this.

daijin12

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Window resizing + Qt
« Reply #5 on: December 26, 2012, 02:21:48 am »
Hi!

I have almost the same problem here. I update SFML today while looking at this topic in order to see if it changes anything, but no changes.

I'm runing on Fedora 17 and the same things appears for me but not all the time. Most of the time, the SFMLCanvas behaves correctly when resizing the widget parent (here I put SFMLCanvas in the central layout of a QMainWindow), but somethimes and especially when I use a lot of CPU with other software at the same time, the bug as describe here appears at he software execution.

The problem disappears using Windows 7.

I'm not an expert of X11 and Qt as Cide is, so I can't say more on that topic. Do you progress a little about that?

Merry Christmas

PS : Sorry for my bad english but I'm french so I do what I can.

« Last Edit: December 26, 2012, 02:24:07 am by daijin12 »