Ticket Change Details
Not logged in

Artifact ID: 6d7c8ac265f053b13db903647c13fc3aa87c5b0c
Ticket: 0c7dac6fccdf5eb668b2073c6cc7777712944c29
[tk scaling] on undroidwish gives different results than on wish, on the same machine
User & Date: anonymous 2019-05-17 11:38:04

  1. icomment:
    More on this issue:
    My goal is to present an sdltk window on a desktop PC that accurately emulates the screen of a mobile phone/tablet device. To achieve this I do the following:
    <li>Write down the target device's densitydpi and density, as returned by the command `borg displaymetrics` run on androwish on the mobile device. An example of such result from an actual device is: `densitydpi 240 density 1.5`</li>
    <li>On the PC, run `undroidwish -sdlxdpi <densitydpi>`, where <densitydpi> is the value returned by the above `borg displaymetrics` command.</li>
    <li>Inside undroidwish, run the following code:</li>
    % tk scaling
    # set `tk scaling` to the <density> value return by `borg displaymetrics`
    % tk scaling 1.5
    # create a shape with specs dependent on device dpi:
    % pack [frame .f -width 20m -height 20m -bg red] -padx 20m -pady 20m 
    <li>Measure the red rectangular representing the specified tk frame widget. Result: It measures exactly the specified 20mm.</li>
    So I conclude that this method gives an adequate solution to the set goal. Now the problem:
    While tk seems to be correctly set to display the content, the sdltk window borders are scaled by the -sdlxdpi value given at the command line, which seems to be approx. 240.0/72 = 3.333.., in the above example. <a href='https://github.com/dzach/awemu/blob/master/issues/sdltk_border.png'>See this screenshot</a>. The size of the font in the console is not a problem; it will resize properly once the console is redrawn by Tk. But...
    I have not found a way to set sdltk's window borders. Tk commands for toplevel windows do not seem to influence sdltk's window decoration in undroidwish. I can make them disappear, e.g. by running `wm overrideredirect`, but then the ability to move the windows around is lost. 
    How can one change window decoration sizes in sdltk? It seems they should be tied to the `tk scaling` that undroidwish comes up with initially.
  2. login: "anonymous"
  3. mimetype: "text/html"