Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Bug reports ➜ WindowResize fills the whole window instead of just the new portion

WindowResize fills the whole window instead of just the new portion

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Sun 06 May 2012 10:21 PM (UTC)

Amended on Thu 10 May 2012 04:20 AM (UTC) by Fiendish

Message
It's funny but this report is exactly the opposite of http://www.gammon.com.au/forum/bbshowpost.php?id=10517

Documentation for WindowResize says
Quote:
If the new size is larger than the existing size the BackgroundColour is used to fill any newly exposed area

But I am experiencing that backgroundcolour is filling the entire window and not just the newly exposed area.

A test plugin is available here that should demonstrate the problem:

http://pastebin.com/raw.php?i=NPhDUztt

Notice the one line using WindowResize that uses a blue background color. And when resizing the displayed window, indeed the whole thing turns blue instead of just the new part. It's the only place blue gets used.

I captured a video here:
http://www.youtube.com/watch?v=ZcWFDI7IgU0

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 07 May 2012 06:45 AM (UTC)
Message

win = "test_" .. GetPluginID ()  -- get a unique name, ensure not empty if outside plugin
WindowCreate (win, 0, 0, 200, 200, miniwin.pos_center_all, 0, ColourNameToRGB("white"))  -- create window
WindowShow (win,  true)  -- show it 

-- Grid
  for i = 1, math.max (WindowInfo (win, 3), WindowInfo (win, 4)) / 20 do
    WindowLine (win, i * 20, 0, i * 20, WindowInfo (win, 4), 0xC0C0C0, miniwin.pen_solid, 1)
    WindowLine (win, 0, i * 20, WindowInfo (win, 3), i * 20, 0xC0C0C0, miniwin.pen_solid, 1)
  end -- for

-- resize it

WindowResize(win, 300, 300, 0xFF0000) 


After running that:



It resized correctly.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #2 on Mon 07 May 2012 11:12 PM (UTC)
Message
Yeah, same for me. But my posted scenario still holds. It probably has to do with calling resize during a mousedrag handler event.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Fiendish   USA  (2,535 posts)  Bio   Global Moderator
Date Reply #3 on Thu 10 May 2012 04:24 AM (UTC)

Amended on Thu 20 Dec 2012 03:57 AM (UTC) by Fiendish

Message
I have updated the plugin url in the original post to be a stripped down test so that it's easier to verify.

My next test will be in Windows 7 as soon as I have a fresh install of it, since currently I am using Wine in Fedora. But other people on Aardwolf already tell me that they also see the whole miniwindow turning blue, so I doubt I'll see other than what is demonstrated in the video.


[EDIT]Actually, I can just put the code here so we don't have to rely on pastebin.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="Resize_Test"
   author="Fiendish"
   id="7d0a741a84e89b3b7fe9a09a"
   language="Lua"
   purpose="Resize Bug Tester"
   requires="4.73"
   save_state="y"
>
</plugin>
<script>
<![CDATA[

require "movewindow"

default_x = 468
default_y = 236
height = 215
width = 269
lastRefresh = 0

function ResizeMoveCallback()
   width = math.max(math.min(WindowInfo(win, 17)+offsetx, GetInfo(281)-windowinfo.window_left), 50)
   height = math.max(math.min(WindowInfo(win, 18)+offsety, GetInfo(280)-windowinfo.window_top), 50)

   if (utils.timer() - lastRefresh > 0.1) then -- don't choke on very slow machines

      -- !!!THE BLUE DISPLAY BUG HAPPENS HERE BECAUSE WINDOWRESIZE IS CALLED INSIDE A DRAG HANDLER!!!
      WindowResize(win, width, height, 0xFF0000)
      WindowMoveHotspot(win, "resize", width-10, height-10, width, height)
      Redraw()

      lastRefresh = utils.timer()
   end
end

function ResizeReleaseCallback()
    SetUpHotspotsAndDraw()
end

function SetUpHotspotsAndDraw()
   WindowCreate (win, windowinfo.window_left, windowinfo.window_top, width, height, windowinfo.window_mode, windowinfo.window_flags, 0x000000)
   movewindow.add_drag_handler (win, 0, 0, 0, 0)

   -- Add handler for resizing
   WindowAddHotspot(win, "resize", width-10, height-10, width, height, "MouseOver", "", "MouseDown", "", "", "", 6, 0)
   WindowDragHandler(win, "resize", "ResizeMoveCallback", "ResizeReleaseCallback", 0)
      WindowShow (win, true)

   -- draw the resize widget bottom right corner
   WindowLine(win, width-3, height-1, width-1, height-3, 0xffffff, 0, 1)
   WindowLine(win, width-5, height-1, width-1, height-5, 0x696969, 0, 2)
   WindowLine(win, width-6, height-1, width-1, height-6, 0xffffff, 0, 1)
   WindowLine(win, width-8, height-1, width-1, height-8, 0x696969, 0, 2)
   WindowLine(win, width-9, height-1, width-1, height-9, 0xffffff, 0, 1)
   WindowLine(win, width-11, height-1, width-1, height-11, 0x696969, 0, 2)
   WindowLine(win, width-12, height-1, width-1, height-12, 0xffffff, 0, 1)
   WindowLine(win, width-14, height-1, width-1, height-14, 0x696969, 0, 1)

   -- draw edge frame
   WindowRectOp (win, 1, 0, 0, 0, 0, 0xdddddd, 15)

   Redraw()
end

function MouseDown(flags, hotspot_id)
   if (hotspot_id == "resize") then
      offsetx = width-WindowInfo(win, 17)
      offsety = height-WindowInfo(win, 18)
   end
end

function OnPluginClose ()
   WindowDelete(win)
end

function OnPluginInstall()
   win = GetPluginID()
   WindowCreate (win, default_x, default_y, 200, 200, 0, miniwin.create_absolute_location, 0x000000)

   --- install the window movement handler, get back the window position.
   windowinfo = movewindow.install (win, miniwin.pos_center, miniwin.create_absolute_location, false, nil,nil,{x=default_x, y=default_y})
   
   -- Draw the initial group window
   SetUpHotspotsAndDraw()
end

]]>

</script>
</muclient>

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Thu 10 May 2012 10:57 AM (UTC)
Message
OK TY I'll look into it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #5 on Fri 22 Nov 2013 06:26 AM (UTC)
Message
I can reproduce it, but I can't see why.

I tried juggling the order in which the function did things, to no avail. The mouse is captured with SetCapture, which may or may not be the reason for this. I tried doing a ReleaseCapture but that had no effect.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


16,103 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.