Skip to content
 

Disabling Swipe from a Fullscreen Game

The swipe is really annoying feature in fullscreen gaming (antsnes for example). Instead of controlling the game you might end up swiping the game into the background, which is not cool. Luckily the swipe can be disabled quite easily from QWidget based classes.
Here’s how you can disable the swipe:

void disableSwipe()
{
    QWidget * activeWindow = QApplication::activeWindow();
    Display *dpy = QX11Info::display();
    Atom atom;
    unsigned int customRegion[4];
    customRegion[0] = 0;
    customRegion[1] = 0;
    customRegion[2] = 854;
    customRegion[3] = 480;
    atom = XInternAtom(dpy, "_MEEGOTOUCH_CUSTOM_REGION", False);
    XChangeProperty(dpy, activeWindow->effectiveWinId(),
            atom, XA_CARDINAL, 32, PropModeReplace,
            reinterpret_cast<unsigned char *>(&customRegion[0]), 4);
}

And here’s an example of enabling it:

void enableSwipe()
{
    QWidget * activeWindow = QApplication::activeWindow();
    Display *dpy = QX11Info::display();
    Atom atom;
    atom = XInternAtom(dpy, "_MEEGOTOUCH_CUSTOM_REGION", False);
    if(XDeleteProperty(dpy, activeWindow->effectiveWinId(), atom) < 0){
      qWarning("XDeleteProperty for _MEEGOTOUCH_CUSTOM_REGION returns <0");
      }
}

15 Comments

  1. faenil says:

    this will be very useful in the near future 🙂

  2. manish says:

    Summeli- 1 question….will there be ny psx4all emulator fr S^3(N8) frm ur side in near future….coz there has been no update about it from a long time….& also u got N950(that cool device)…so i m just asking if u r working on it…i wud love to use it on my n8….
    Waiting fr ur reply
    (Summeli’s fan)

  3. Ihana says:

    Could you port a Sega Dreamcast and a Dolphin (Gamecube and Wii) emulator for the N9? It would blow every other phone ever made on the face of the earth right out the water.
    On Ubuntu I install it like this:
    sudo add-apt-repository ppa:glennric/dolphin-emu
    sudo apt-get update
    sudo apt-get install dolphin-emu
    http://www.youtube.com/watch?v=S7VUp7K8UO8
    http://www.lxdream.org/news/
    deb http://www.lxdream.org/debian unstable main
    deb-src http://www.lxdream.org/debian unstable main
    http://www.youtube.com/watch?v=t7StREpLZvg

    • Summeli says:

      NO, I’m not going to do it. “porting it” is a lot more then using apt-get install. It has dynarec for X86, you would have to remake that for ARM, and of course you would have to write a new UI for it. After that you can start worrying that N9 might not have enough CPU power to run such thing. It’s a HUGE project, and I don’t have time for anything like that.

  4. Pzkfw5 says:

    Do you think any future emulator updates could support the icontrolpad? It’s a completely open source bluetooth controller from the same guys who made the Open Pandora. I just got one and it fits the Nokia N8 perfectly.

  5. Jiman says:

    Hi Summeli,
    I hope you will add nes games support for AntSnes, able to play old nes games was a great add on.
    Br
    Jiman

  6. Ngoanrazor says:

    hi summeli!
    I have a problem, I asked on forum nokia but no satisfactory solution to resolve this issue, can you help me? 🙂
    this problem is how to know homescreen with uid 0x102750f0 is foreground (application write in qt) ? I want replace homescreen 5800 with application qt. Thank you read! 🙂

  7. elemental says:

    Great work, but there is better way to disable swipe – using _MEEGOTOUCH_CANNOT_MINIMIZE. Take a look at qt-components repo in mdeclarativescreen.cpp file.

Leave a Reply

(required)