mIRC Homepage
Posted By: rockcavera Active window bug - 17/03/17 03:52 AM
I suppose I'm in the #test channel and open a dialog by the command "/dialog -m dialogtest dialogtest" (Actually does not have to be a channel, but any window other than the Status Window).

The dialog dialogtest has a button that opens and closes an @testwindow.

When you open @testwindow, the #test channel is in the second plane in mIRC.

However, when the @testwindow is closed, with the dialogtest open, the #test channel, which is in the second plane, is not left as the active window for mIRC, but being active as "Status Window". But actually "Status Window" is not active on the screen, but rather the channel.

Is this a correct behavior or a bug?

Code to reproduce:
Code:
alias dialogtest dialog $iif($dialog(dialogtest),-v,-m dialogtest) dialogtest

dialog dialogtest {
  title "test"
  size -1 -1 75 33
  option dbu
  button "Open/Close @testwindow", 1, 3 4 70 12
  text "", 2, 3 21 70 8
}

on *:DIALOG:dialogtest:init:0:did -o $dname 2 1 Active: $active

on *:DIALOG:dialogtest:close:0:echo -a Active: $active

on *:DIALOG:dialogtest:sclick:1:{
  if ($window(@testwindow)) {
    window -c @testwindow
    did -o $dname 2 1 Active: $active
    echo -a Active: $active
  }
  else {
    window @testwindow
    did -o $dname 2 1 Active: $active
    echo -a Active: $active
  }
}


1. before it is in a window other than "Status Window"
2. open the dialog /dialogtest
3. click on the button in the dialog, open @testwindow
4. click on the button again, close @testwindow
5. close the dialog

Note that when opening and closing @testwindow, the window is active is the "Status Window", but when closing the dialog, the active window is activated before opening the dialog.

The correct one would not be the window that was opened the dialog being the active window after closing @testwindow?
Posted By: Khaled Re: Active window bug - 17/03/17 11:05 AM
Thanks for your bug report. I was able to reproduce this issue. The window focus handling in mIRC is really complicated. A large of number of special case situations are handled, added over many years. I have made a change in the next beta that resolves your issue, however we will need to keep an eye out for any side-effects.
Posted By: rockcavera Re: Active window bug - 18/04/17 12:39 AM
Hello, Khaled.

I noticed a strange behavior when closing a desktop window in version 7.48 that did not present in 7.47.

First, activate the treebar, because it is easier to visualize what I will explain.

Now make active any window other than the Status Window. Example: a #channel

Open a @window desktop: /window -dC @test

Close the desktop window @test on [x]

Notice that the focus on the treebar goes to Windows Status and, in a fraction of a second, to the last active window.

Test these procedures in versions 7.47 and 7.48.


I did not notice any negative effect for mIRC with this situation, but only aesthetic.
Posted By: Khaled Re: Active window bug - 29/04/17 09:11 AM
The reason for this is that when you close a window, mIRC has to designate an active window internally. This remains the active window until mIRC receives a window activation message from Windows. This message may never come (for example, when you close the desktop @window, this may switch you to another application). Once mIRC does receive a window activation message, it sets that window as the active window. So no matter how this is implemented, you will always see a temporary change in focus in the treebar/switchbar. However, I can probably improve this a little more by checking window ordering and setting the next active window that way. This will be in the next beta.
Posted By: rockcavera Re: Active window bug - 03/05/17 04:07 AM
I tested the Beta and the focus behavior was very good.

Thank you, Khaled.
© mIRC Discussion Forums