Giter Site home page Giter Site logo

wrong window size on start about plan9port HOT 5 CLOSED

9fans avatar 9fans commented on July 22, 2024
wrong window size on start

from plan9port.

Comments (5)

 avatar commented on July 22, 2024

Quick fix, hardcoding windowrect to screenrect, so the app assumes it is full screen, no status bar:
https://github.com/gituser1357/plan9port/commit/c15ec21b1802f4ed02d89156d731fa8f09644688
YMMV.

from plan9port.

camoles avatar camoles commented on July 22, 2024

But what if the app is not the only one on the screen? This fix is worse than the problem.

from plan9port.

camoles avatar camoles commented on July 22, 2024

"If you use Xlib to create your own top-level windows (direct children of the root window), you must observe the following rules so that all applications interact reasonably across the different styles of window management:

You must never fight with the window manager for the size or placement of your top-level window.
You must be able to deal with whatever size window you get, even if this means that your application just prints a message like ``Please make me bigger'' in its window."

source: https://tronche.com/gui/x/xlib/window/create.html

from plan9port.

eekee avatar eekee commented on July 22, 2024

blinkblinkblinkblink uh.. buh.. wha...t is this i don't even...

i mean the "fix", good grief! "ymmv" indeed. on the other hand, maybe gituser1357 can come over and fix my network; i can't pull or push over http right now, and i can't fix it to save my life! :) or maybe i just need chuck norris to 'talk' to my isp; they're blocking http but nothing else.

now then, x11 apps & window managers:
when opening a window, the app requests a size. the window manager may change that size when mapping the window. (i can't remember the exact details, i last tackled this around 2007, but i know this happens before the window is mapped.) i expect what p9p apps do is assume the requested size was accepted. this was never the right thing to do.

i'll have a look at the code in a bit. i should have looked at it years ago; i'm not camoles but i'm pretty sure i contributed to the report above via irc chat. it's basically been the same for years under so many different window managers.

from plan9port.

rsc avatar rsc commented on July 22, 2024

The code does this when creating the window:

    /*
     * Put the window on the screen, check to see what size we actually got.
     */
    XMapWindow(_x.display, w->drawable);
    XSync(_x.display, False);

    if(!XGetWindowAttributes(_x.display, w->drawable, &wattr))
            fprint(2, "XGetWindowAttributes failed\n");
    else if(wattr.width && wattr.height){
            if(wattr.width != Dx(r) || wattr.height != Dy(r)){
                    r.max.x = wattr.width;
                    r.max.y = wattr.height;
            }
    }else
            fprint(2, "XGetWindowAttributes: bad attrs\n");

It also responds to XConfigureEvents that resize the window.

I found that windowrect was not being updated with the new r, and I fixed that, but I don't see how that would cause the behavior described, since windowrect only applies when toggling full screen mode manually.

I'm going to close this. If it gets reported again maybe we can get more information about the X messages involved.

from plan9port.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.