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

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: 5506
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: 5506
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: 5506
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