Author Topic: Multi-monitor dialog positioning bug [patch]  (Read 44715 times)

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Multi-monitor dialog positioning bug [patch]
« on: December 15, 2005, 06:27:46 am »
Dialogs open on the primary display in Windows regardless of which monitor the codeblocks window is open on. Dialogs should open on the same monitor as Code::Blocks is currently displayed on.

This patch fixes the issue. :) Patch applies using TortoiseSVN in codeblocks/src.

Code
Topic: Multi-monitor dialog position update
Description:
  ! Dialogs would not open on the same screen as the parent dialog when the parent
    is not on the primary display in a multi-monitor Windows environment

I followed the tabs/spaces pattern of each file. In files where I saw that the entire file followed one pattern (say hard tabs) except for one or two lines in a function I updated (that used spaces) I fixed those two lines. In files that were "mixed content" through the file, I left those alone.

If you look at the patch copy in a whitespace viewer, you will see that I was consistent for each file and did not change any patterns.

[attachment deleted by admin]
« Last Edit: December 15, 2005, 08:55:47 am by 280Z28 »
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug
« Reply #1 on: December 15, 2005, 07:37:17 am »
By the way, I have just assumed that I'm not supposed to have commit access to the repository. That's why I've just posted patches. If y'all are expecting me to commit my changes you'll have to let me know or it'll never get done.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Multi-monitor dialog positioning bug
« Reply #2 on: December 15, 2005, 07:38:23 am »
vey well done, this is indeed very annoying, if you need to switch monitors because that dialog popped up somewhere else.
Waiting for an svn update where Yiannis applied yoiur changes .........  8)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Multi-monitor dialog positioning bug
« Reply #3 on: December 15, 2005, 07:51:02 am »
i've applied your patch to my working copy and it is a big improvement ! thanks

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #4 on: December 15, 2005, 10:01:00 am »
Lol, don't get a wrong idea because I say something opposing every time you come up with something. :lol:
Dialogs should open on the same monitor as Code::Blocks is currently displayed on.
This is very much a matter of taste, and in my opinion not generally true.

It depends how you use your secondary monitor, and on the size of your monitors. I often send a program to the secondary screen when working with two apps (that may even be two instances of Code::Blocks), but I expect message boxes and dialogs to open on the primary screen.
This has a simple biological reason. The main screen is within the central 30° of my field of view, but the secondary screen in the peripheral field. Objects in the peripheral field are not seen as good as the ones in the central field, obviously, so you have to look aside or turn your head.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #5 on: December 15, 2005, 12:53:55 pm »
Lol, don't get a wrong idea because I say something opposing every time you come up with something. :lol:
Dialogs should open on the same monitor as Code::Blocks is currently displayed on.
This is very much a matter of taste, and in my opinion not generally true.

It depends how you use your secondary monitor, and on the size of your monitors. I often send a program to the secondary screen when working with two apps (that may even be two instances of Code::Blocks), but I expect message boxes and dialogs to open on the primary screen.
This has a simple biological reason. The main screen is within the central 30° of my field of view, but the secondary screen in the peripheral field. Objects in the peripheral field are not seen as good as the ones in the central field, obviously, so you have to look aside or turn your head.

Generally I'm all for customizability, but in this case I'm going to just say that is the wrong action. I use two monitors because I do two different things on two different screens, and the monitor something appears on should be associated with the program I placed there to start with. Having to drag the mouse back and forth and back and forth is extremely irritating. Also, they open in the corner of the main monitor. You may be used to the dialogs always opening on the primary screen, but that is because you've become used to improper program behavior. This program should behave like a every other program and not be the one program to decide to do things differently. It should definitely be changed from the way it is now.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #6 on: December 15, 2005, 01:23:33 pm »
You may be used to the dialogs always opening on the primary screen, but that is because you've become used to improper program behavior.
That is not the case, it is a choice of ergonomy. Which solution is best for you depends on how large your monitors are and where you place them (and what kind of work you do).

This program should behave like a every other program and not be the one program to decide to do things differently.
The decision where a window (or a dialog for that matter) opens should not be the application's choice unless there is a good reason for this. One notable case where making this kind of decision in the application is the window that shows code completion tips. It is of course quite silly to show this window on a display different than the one holding the main window. But for all other cases, it is the window manager's choice where to put a window, not the application's.
Whatever the user prefers (same display, primary display, centered, on top) can be configured inside the window manager (or in desktop settings under MS Windows).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #7 on: December 15, 2005, 01:30:25 pm »
Can we please let this be a user preference then? I'll go back and change every single line to allow it to be optional, but please, please let there be at least an option for them to open on the same screen.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Multi-monitor dialog positioning bug [patch]
« Reply #8 on: December 15, 2005, 01:37:19 pm »
...Whatever the user prefers (same display, primary display, centered, on top) can be configured inside the window manager (or in desktop settings under MS Windows).
how does this work ??? i never found a setting in windows which would allow me to specify where a dialog from any program pops up ?
i'm using WinXP SP2

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #9 on: December 15, 2005, 01:38:17 pm »
...Whatever the user prefers (same display, primary display, centered, on top) can be configured inside the window manager (or in desktop settings under MS Windows).
how does this work ??? i never found a setting in windows which would allow me to specify where a dialog from any program pops up ?
i'm using WinXP SP2

You can't ;)
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #10 on: December 15, 2005, 01:42:55 pm »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #11 on: December 15, 2005, 01:44:04 pm »
You can't ;)
Yeah right, you can't. ;)



That's an option in your video card drivers, not a normal one at all.

Edit: Hey, now we see that you have no reason not to patch it now. ;)
« Last Edit: December 15, 2005, 01:46:03 pm by 280Z28 »
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #12 on: December 15, 2005, 01:50:27 pm »
Well, I assume you don't run Windows XP using the VGA driver ;)
All mainstream video card drivers for Windows let you do such customizations.
Linux is another story, but there it is the window manager's business.

EDIT:
Edit: Hey, now we see that you have no reason not to patch it now. ;)
Not only do I not have a reason not to patch it, but I really don't want to. If an application explicitely asks for a window to be put onto some display, then it is really placed there. So this would not only have no advantage, but it would actually interfere with the "normal" operation.
« Last Edit: December 15, 2005, 01:53:47 pm by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #13 on: December 15, 2005, 01:59:11 pm »
So if I make it an option will you add it?
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #14 on: December 15, 2005, 02:10:49 pm »
No objection from my side if it is an option.

What about simple message boxes? Are those consistent with the other dialogs  with your modifications?
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #15 on: December 15, 2005, 02:12:05 pm »
No objection from my side if it is an option.

What about simple message boxes? Are those consistent with the other dialogs  with your modifications?

Not sure which ones are simple. I just changed all the ones that call LoadDialog() in their constructor (since that was easy to search for).

I'll make it an option tonight and post a new patch.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Multi-monitor dialog positioning bug [patch]
« Reply #16 on: December 15, 2005, 02:42:41 pm »
OK, I haven't stepped in this discussions since I don't really care about the subject :P (I work on a single monitor setup). So I 'll let you, who have dual monitor setups,  resolve this.

But, 280Z28, do *not* post patches here. They are only going to be lost/forgotten. Patches should be submitted to the patch tracker. That's what we have it for. A forum is *not* a project management tool or medium...
Be patient!
This bug will be fixed soon...

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #17 on: December 15, 2005, 02:43:39 pm »
OK, I haven't stepped in this discussions since I don't really care about the subject :P (I work on a single monitor setup). So I 'll let you, who have dual monitor setups,  resolve this.

But, 280Z28, do *not* post patches here. They are only going to be lost/forgotten. Patches should be submitted to the patch tracker. That's what we have it for. A forum is *not* a project management tool or medium...

Yeah I just saw that in another thread. I didn't realize you were using it. :)
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #18 on: December 16, 2005, 01:03:54 am »
OK I'm ready to make this an option. I need to add the following function to the SDK. Where should I put it, and what class should it be a public member of? I'm thinking Manager.

Code
static void Manager::PositionUserDialog( wxDialog* dlg )
{
    if (user wants dialogs repositioned centered on parent)
    {
        dlg->CenterOnScreen();
    }
}
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #19 on: December 16, 2005, 01:18:54 am »
Code
template<wxDialog* D>PlaceDialog()
{
if(Manager::Get()->GetConfigManager("app")->Exists("/environment/place_dialogs"))
    D->CentreOnScreen();
};
That way, we don't pollute Manager -- this does not belong in there.

EDIT: Don't blame me if I have a typo in there... it is late, and I am falling asleep... But you get the idea :)
« Last Edit: December 16, 2005, 01:21:38 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #20 on: December 16, 2005, 01:20:24 am »
Code
template<wxDialog* D>PlaceDialog()
{
if(Manager::Get()->GetConfigManager("app")->Exists("/environment/place_dialogs"))
    D->CentreOnScreen();
};
That way, we don't pollute Manager -- this does not belong in there.

What file?

Yeah, it didn't seem to belong to any of the others though. Are you saying just put it the global namespace?
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Multi-monitor dialog positioning bug [patch]
« Reply #21 on: December 16, 2005, 01:21:40 am »
Hmmm try xtra_classes.cpp - i made that for your custom classes.

Edit: I don't remember the exact name.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multi-monitor dialog positioning bug [patch]
« Reply #22 on: December 16, 2005, 01:23:15 am »
But you'd rather put the template in the header, not the cpp

EDIT:
... and you will want to add the void which I forgot, or the compiler won't let you get away.
« Last Edit: December 16, 2005, 01:25:27 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #23 on: December 16, 2005, 01:28:23 am »
But you'd rather put the template in the header, not the cpp

EDIT:
... and you will want to add the void which I forgot, or the compiler won't let you get away.

Yep I was a step ahead of you there. I have this in sdk\xtra_classes.h:

Code
template<wxDialog* D> void PositionUserDialog(bool force=false)
{
    if(force || Manager::Get()->GetConfigManager("app")->Exists("/environment/place_dialogs"))
        D->CenterOnScreen();
}
« Last Edit: December 16, 2005, 01:33:10 am by 280Z28 »
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Multi-monitor dialog positioning bug [patch]
« Reply #24 on: December 16, 2005, 01:39:13 am »
Just a question. Why a template?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #25 on: December 16, 2005, 01:42:51 am »
Just a question. Why a template?

I actually already made it not a template. :o
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #26 on: December 16, 2005, 02:17:32 am »
Why are there sooo manyy blank lines with just trailing spaces in env_settings.xrc?
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #27 on: December 16, 2005, 04:11:08 am »
Applies cleanly to rev 1524. There are a ton of files updated, so chances of a conflict if this is outstanding for a while is high.

I did not make any changes to surrounding whitespace. I only made the required changes to fix this one bug.

The new option is on the view tab of environment settings.

Sam 8)

[attachment deleted by admin]
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Multi-monitor dialog positioning bug [patch]
« Reply #28 on: December 16, 2005, 07:40:25 am »
(I work on a single monitor setup).

Dual monitor is superb during coding and debugging. That nasty gui you are debugging is always visible (you drag it on the other screen) and when you hit your breakpoint you can still see it nicely. It helped me a lot in my M$ devstudio gui projects, otherwise the IDE get's focus on the breakpoint or the code you are stepping through and you don't see the GUI window anymore since it's behind the IDE window.

And it is also very nice, to have on a second monitor a Firefox open on the CB page, forum page, so you can check from time to time for the new information.
;-)

I am kinda missing Yiannis's today's changes (well I see them in svn anyway).

Maybe we should buy Yiannis a second monitor for x-mas ...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Multi-monitor dialog positioning bug [patch]
« Reply #29 on: December 16, 2005, 03:58:11 pm »
Applies cleanly to rev 1524. There are a ton of files updated, so chances of a conflict if this is outstanding for a while is high.

I did not make any changes to surrounding whitespace. I only made the required changes to fix this one bug.

The new option is on the view tab of environment settings.

Sam 8)

Just tell me Sam: how many times do I have to repeat myself about not posting patches in the forums?  :?
Be patient!
This bug will be fixed soon...

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #30 on: December 16, 2005, 04:00:44 pm »
Applies cleanly to rev 1524. There are a ton of files updated, so chances of a conflict if this is outstanding for a while is high.

I did not make any changes to surrounding whitespace. I only made the required changes to fix this one bug.

The new option is on the view tab of environment settings.

Sam 8)

Just tell me Sam: how many times do I have to repeat myself about not posting patches in the forums?  :?

It was late and I'm used to it.  :? Sorry man :( :( I sent a PM to thomas. I'll make sure I post my patches on SF from here on! But do you want me to add this one there too, even though it's here now and you've both seen it? I'll do it right now if you want.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Multi-monitor dialog positioning bug [patch]
« Reply #31 on: December 16, 2005, 04:02:48 pm »
Sam,

do it in sf also.
Then other users can also get it, I'dd also like to build with it, just to test it.
And certainly the print fixes.
I'll just have two CB dirs for building the 'svn' and 'svn+ fixes'. Planning on starting nightly builds also, maybe I can then provide them both.

Lieven

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #32 on: December 16, 2005, 04:05:13 pm »
Sam,

do it in sf also.
Then other users can also get it, I'dd also like to build with it, just to test it.
And certainly the print fixes.
I'll just have two CB dirs for building the 'svn' and 'svn+ fixes'. Planning on starting nightly builds also, maybe I can then provide them both.

Lieven

Ok I did the dialogs one. :) Print ones I'll post from work today.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Multi-monitor dialog positioning bug [patch]
« Reply #33 on: December 17, 2005, 11:23:46 am »
Hi Sam,
i applied your centerdialogs.patch from sf
https://sourceforge.net/tracker/index.php?func=detail&aid=1382498&group_id=126998&atid=707418

and it works almost fine.
A problem are the various progress-bars, which pop up on the main monitor, when i run CB on the second monitor.
i guess this is a wxwidgets-problem, but we have to solve this too.

btw. what wx-version (261 or 262, ansi or unicode) are you using for main development and/or testing ?
i'm currently working still with wx261 (with patch 01) , ansi build.

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #34 on: December 17, 2005, 01:45:58 pm »
Those are bugs in wxWidgets itself. For example, note that CenterOnParent() does nothing at all when the parent is not on the primary display.

Once I get them isolated I'll submit a report to them.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Multi-monitor dialog positioning bug [patch]
« Reply #35 on: December 17, 2005, 05:59:41 pm »
src/main.cpp:1418
Code
void MainFrame::OnFileOpen(wxCommandEvent& event)
{
    wxFileDialog* dlg = new wxFileDialog(this,
                            _("Open file"),
                            wxEmptyString,
                            wxEmptyString,
                            SOURCE_FILES_DIALOG_FILTER,
                            wxOPEN | wxMULTIPLE);
    dlg->SetFilterIndex(SOURCE_FILES_FILTER_INDEX);

    //PositionUserDialog(dlg);   <-- CRASHES ON  "dlg->CenterOnScreen();"  IF ENABLED

    if (dlg->ShowModal() == wxID_OK)
    {
        wxArrayString files;
        dlg->GetPaths(files);
        OnDropFiles(0,0,files);
    }

    delete dlg;
}

it seems as are some windows-system dialogs not allowed to be CenterOnScreen'ed  8)

Offline tiwag

  • Developer
  • Lives here!
  • *****
  • Posts: 1196
  • sailing away ...
    • tiwag.cb
Re: Multi-monitor dialog positioning bug [patch]
« Reply #36 on: December 18, 2005, 09:06:42 pm »
@280z
any comments ?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #37 on: December 18, 2005, 09:40:02 pm »
I had given up on this since there wasn't much interest expressed in patching this. I'll take a look again.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Multi-monitor dialog positioning bug [patch]
« Reply #38 on: December 18, 2005, 10:00:35 pm »
It's clearly a bug in wxWidgets, and it's even more clear that what I stated is the truth. A child dialog should open over the parent, end of story.

Every dialog in wxWidgets calls this when it is created:

Code
CentreOnParent();

The centering bug lies in that code.

My code worked around that by calling:

Code
CentreOnScreen();

which apparently works.

Note the following declarations from wxWidgets-2.6.2\include\wx\window.h:344

Code
        // the generic centre function - centers the window on parent by`
        // default or on screen if it doesn't have parent or
        // wxCENTER_ON_SCREEN flag is given
    void Centre( int direction = wxBOTH );
    void Center( int direction = wxBOTH ) { Centre(direction); }

        // centre on screen (only works for top level windows)
    void CentreOnScreen(int dir = wxBOTH) { Centre(dir | wxCENTER_ON_SCREEN); }
    void CenterOnScreen(int dir = wxBOTH) { CentreOnScreen(dir); }

        // centre with respect to the the parent window
    void CentreOnParent(int dir = wxBOTH) { Centre(dir | wxCENTER_FRAME); }
    void CenterOnParent(int dir = wxBOTH) { CentreOnParent(dir); }

The code for Centre() that handles all of the above functionality is in wxWidgets-2.6.2\src\common\wincmn.cpp:394

I'll do a diff later of the file from the one in the wxWidgets trunk and see if any changes have been made to that code. Now I'm going bowling. :)
« Last Edit: December 18, 2005, 10:08:54 pm by 280Z28 »
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Multi-monitor dialog positioning bug [patch]
« Reply #39 on: December 18, 2005, 11:16:11 pm »
Very off topic : I went bowling yesterday.  :P

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Multi-monitor dialog positioning bug [patch]
« Reply #40 on: December 18, 2005, 11:23:27 pm »
Very off topic : I went bowling yesterday.  :P

...I never played bowling :(.

Michael

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5491
Re: Multi-monitor dialog positioning bug [patch]
« Reply #41 on: December 18, 2005, 11:30:46 pm »
even more off topic : In another thread they were talking about Solitaire plug-in, Freecell ,etc in CB, well maybe a bowling game plug-in might be nice.

Sorry for this of topic crap, just couldn't resist.

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Multi-monitor dialog positioning bug [patch]
« Reply #42 on: December 18, 2005, 11:41:56 pm »
even more off topic : In another thread they were talking about Solitaire plug-in, Freecell ,etc in CB, well maybe a bowling game plug-in might be nice.

And before Rick will cut my hands (sorry for overcharging the bandwidth) :), let me add a "MyGames" menu in the C::B toolbar to put inside all such nice game plugins :P.

Michael