Skip to content

Add a workaround for mapper creation breaking getMainWindowSize()#2945

Merged
vadi2 merged 4 commits intoMudlet:developmentfrom
vadi2:fix-getmainwindowsize-geyser
Aug 12, 2019
Merged

Add a workaround for mapper creation breaking getMainWindowSize()#2945
vadi2 merged 4 commits intoMudlet:developmentfrom
vadi2:fix-getmainwindowsize-geyser

Conversation

@vadi2
Copy link
Copy Markdown
Member

@vadi2 vadi2 commented Aug 6, 2019

Brief overview of PR changes/additions

Somehow getMainWindowSize() - only on Windows, if right after the mapper creation (same script or profile load), and only for the first time - would report incorrect sizes.

This is because mpRightToolBar, mpTopToolBar, and mpLeftToolBar which hold the easy buttons somehow themselves got sizes right when we call mpMapper->show(); - super strange, but an event filter verified that is the case - and then shrunk back down immediately.

No clue why they get a size, but this workaround does the job.

Motivation for adding to Mudlet

Important bugfix for an annoying issue.

Other info (issues closed, discussion etc)

Fix #2076, fix #2023.

@vadi2 vadi2 added this to the 4.1.0 milestone Aug 6, 2019
@vadi2 vadi2 requested a review from a team as a code owner August 6, 2019 20:18
@vadi2 vadi2 requested a review from a team August 6, 2019 20:18
@add-deployment-links
Copy link
Copy Markdown

add-deployment-links bot commented Aug 6, 2019

Hey there! Thanks for helping Mudlet improve. 🌟

Test versions

You can directly test the changes here:

No need to install anything - just unzip and run.
Let us know if it works well, and if it doesn't, please give details.

@bduza
Copy link
Copy Markdown

bduza commented Aug 7, 2019

Tested with test code from bug 2023 and also with both new and old versions of GUIframe. Can confirm that while in certain situations there is visual evidence of the bug, it fixes itself within moments and the process of using the mapper in GUIframe is no longer a delicate process - it can all be done on startup without any need to use timers or events.
So, in my opinion, the workaround is good.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Aug 7, 2019

Hm, for me it was fixed normally, when I run the code:

print('Before draw: ' .. tostring(getMainWindowSize()))
createMapper(0,0,500,500)
print('After draw: ' .. tostring(getMainWindowSize()))

The values are all correct:

[  OK  ]  - Lua module rex_pcre loaded.
[  OK  ]  - Lua module zip loaded.
[  OK  ]  - Lua module lfs loaded.
[  OK  ]  - Lua module sqlite3 loaded.
[  OK  ]  - Lua module utf8 loaded.
[  OK  ]  - Lua module yajl loaded.
[  OK  ]  - Mudlet-lua API & Geyser Layout manager loaded.
Before draw: 1855    
[ INFO ]  - Map audit starting...
[  OK  ]  - Auditing of map completed (0.00s). Enjoy your game...
[  OK  ]  - Map loaded successfully (500s).
    MAP BASICS (Quick Start Guide)
    ----------------------------------------
    To see this again: map basics

    Quick Commands:
    1. map help
       This will bring up a more detailed help file, starting with the available
       help topics.
    2. map show
       This will toggle the map window. If you don't see the map window, type
       this command first.
    3. find prompt
       This will make the script start looking for a prompt using several standard
       prompt patterns. If a prompt is found, you will be notified, if not, you
       will need to set a prompt pattern yourself.
    4. map prompt
       This sets the prompt pattern you specify, using Lua String Library type
       patterns.
    5. map ignore
       This creates a pattern for text to ignore when the script is looking for
       the room name. This should include anything that might appear between
       the sent movement command or the prompt preceeding the room description,
       and the room name itself. This can also be used to remove extra text
       on the same line as the room name that should not be included.
    6. map debug
       This toggles debug mode. When on, messages will be displayed showing what
       information is captured and a few additional error messages that can help
       with getting the script fully functional.

    At this point, there are two ways to use the script:
    (A) Load in a map file using a script provided from another user. That user
        will need to specify any manual adjustments to the script that one might
        need to make to make their script work.
    (B) Begin mapping yourself. If you want to map yourself, the help files do
        their best to explain every alias and script tool. If you need further
        assistance, reach out to the Mudlet community.

After draw: 1855    
[  OK  ]  - Profile "Clessidra" loaded in offline mode.
[ INFO ]  - Map audit starting...
[  OK  ]  - Auditing of map completed (0.00s). Enjoy your game...

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Aug 7, 2019

Can you describe how to reproduce the problem you're seeing now?

@vadi2 vadi2 requested a review from a team August 7, 2019 10:05
@Kebap
Copy link
Copy Markdown
Contributor

Kebap commented Aug 7, 2019

Is this a reason why Midnight Sun always starts with a shrunk GUI? If so, reproducing is easy, just login.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Aug 7, 2019

Yep, this fixes that GUI too in my testing. Can you confirm?

Copy link
Copy Markdown
Member

@keneanung keneanung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many of the changes here look as if they don't belong here.

@vadi2
Copy link
Copy Markdown
Member Author

vadi2 commented Aug 12, 2019

I've fixed the diff. This is good for review.

@vadi2 vadi2 merged commit 0bd4224 into Mudlet:development Aug 12, 2019
@vadi2 vadi2 deleted the fix-getmainwindowsize-geyser branch August 12, 2019 13:02
vadi2 added a commit to dicene/Mudlet that referenced this pull request Aug 13, 2019
…dlet#2945)

* Add a workaround for mapper creation breaking getMainWindowSize()

* Revert "Fix errors when creating new triggers (Mudlet#2868)"

This reverts commit 0578c61.

* Fix typo
vadi2 pushed a commit that referenced this pull request Aug 20, 2019
* Initial commit. Adds ctrl+tab shortcut and logic for moving from pane to pane in the trigger editor.

* Shortcut works without menu action. Forward tabbing logic seems to be right.

Just missing reverse shortcut and logic.

* Added CTRL+SHIFT+Tab shortcut to tab through sections in reverse order.

* Removed unnecessary debug code.

* Factor out drawing exits in the map into a separate method (#2941)

* WIP

* Const the variables that we can

* Format

* Reorganize windows sdk (#2958)

* Move declaration of install functions

This allows us to use them singularly in a different context.

* Use our own edbee with updated QsLog (#2914)

Intention is to send all improvements upstream but not be delayed by them getting merged.

* Fix userwindows not going away on profile close (#2959)

* Use correct URL to download the coverity software

* Don't show SSL certificate info until we have one in Profile Preferences (#2953)

* Don't show SSL certificate info until we have one & streamline UI

* Remove colorroles

* Add a workaround for mapper creation breaking getMainWindowSize() (#2945)

* Add a workaround for mapper creation breaking getMainWindowSize()

* Revert "Fix errors when creating new triggers (#2868)"

This reverts commit 0578c61.

* Fix typo

* Don't include TLS code code when it's not available (#2965)

* Raise minimum to Qt 5.11 (#2944)

* Raise minimum to Qt 5.11

* Update Travis minimum Qt build

* Remove < Qt 5.11 workarounds (#2969)

* Replace a couple of cases of std::tie with auto (#2967)

* Replace a couple of cases of std::tie with auto

* A few more

* Fix Coverity TTimer mRepeating initialiser warning (#2972)

* Fix updateDialog uninitialised in constructor (#2973)

* Fix nullptr warning around curVar (#2974)

* Fix a possible nullptr dereference if the room wasn't found for some reason (#2975)

* getRoom() will return nullptr if the room id is negative (#2976)

* Add autocomplete toggle (#2679)

* Update tooltip, more than IRE now provide maps (#2668)

* Add autocomplete toggle to profile

* Update to a version of edbee with autocomplete toggle

* Wire in the autocomplete toggle

* Use correct host variable

* Add missing toggle call

* Formatting changes up simplification of some code.

* Added closing bracket that I must have accidentally deleted while resolving conflicts.
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

Successfully merging this pull request may close these issues.

Geyser window placement bug createMapper() in win 10 causes getMainWindowSize() to return false values

4 participants