The process to have your code incorporated is to brach on Bazaar, and request a 
merge there.  Not to e-mail patches.

It’s a SCM. Learn it.


> On Feb 11, 2015, at 4:19 AM, Michal Sojka <[email protected]> wrote:
> 
> On So, úno 07 2015, Alexander Wolf wrote:
>> Dear Michal,
>> 
>> 2015-02-06 15:02 GMT+06:00 Michal Sojka <[email protected]>:
>> 
>>> I need to configure on which screen Stellarium starts so I put together
>>> the following patch. I haven't found what is the patch submitting
>>> procedure, so feel free to point me to the right place.
>> 
>> We use bazaar for development of the Stellarium -
>> https://code.launchpad.net/stellarium and receive patches with different
>> ways - through branches in bazaar, patches in the bug reports, forum's
>> messages and e-mails.
> 
> OK. So I'll keep posting patches via email as I use git and I'm not
> familiar with Bazaar.
>> 
>>> On multi-screen setups, Stellarium always starts on primary screen. This
>>> 
>> patch adds a configuration-file option to configure the screen where
>>> Stellarium appears. This option is only effective if fullscreen=true. In
>>> windowed mode, the used screen depends on screen_x and screen_y options.
>>> 
>>> This was tested on Linux and Windows on top of 0.13.2 and it compiles
>>> with the current HEAD.
>>> 
>> 
>> Thank you for the patch but... you should add modifications in the code for
>> the both cases - fullscreen and windowed mode.
> 
> Done. See patch v2 below.
> 
>> 
>>> [video]
>>> fullscreen                          = true
>>> +fullscreen_num                      = 0
>>> 
>> 
>> Maybe screen number will be more predictable here?
> 
> I renamed it as screenNumber. If it was screen_number, it would sort
> between screen_h and _w, which I don't like :)
> 
>> 
>> 
>>> +               QRect screenGeom = desktop->screenGeometry(screen);
>>> +               move(QPoint(screenGeom.x(), screenGeom.y()));
>>> +               resize(screenGeom.width(), screenGeom.height());
>>> 
>> 
>> Why you use resize() here? This code will be switch Stellarium to "expanded
>> windowed mode" - not a fullscreen mode.
> 
> This is to ensure that the window is not larger than the screen. I
> majority of the windows appears on another screen, the window would
> appear there. I added comment to the code.
> 
>> Plus how about multiscreen for X11
>> users?
> 
> This doesn't work as it would probably require using QGuiApplication and
> other Qt5-only stuff. I'm not sure whether/how do you plan to transition
> to this. Any way, this is not important as one can set DISPLAY
> explicitely to make stellarium start on the specific screen. This is
> mentioned in the commit message.
> 
> Thank.
> -Michal
> 
> From b9d69780bb0247c49acc8e85e37f90b484940d5f Mon Sep 17 00:00:00 2001
> From: Michal Sojka <[email protected]>
> Date: Thu, 5 Feb 2015 21:53:26 +0100
> Subject: [PATCH v2] Allow configuring the used screen in multiscreen setups
> 
> On multi-screen setups, Stellarium always starts on primary screen. This
> patch adds a configuration-file option to configure the screen where
> Stellarium appears.
> 
> This was tested on Windows 7 and several Linux desktops on top of 0.13.2
> and it compiles with current HEAD. The results of testing are as
> follows:
> 
> - Windows 7: Works correctly.
> 
> - Linux/Gnome: Works correctly expect when fullscreen = false and
>  screen_x = screen_y = 0. In this case, the window is positioned in the
>  middle of screen 0. When any of screen_x/y is set to at least 1, the
>  window appears on the right screen.
> 
> - Linux/Xfce: Fullscreen window always appears on the screen with mouse
>  cursor.
> 
> - Linux/KDE: Works correctly.
> 
> Configuring the screen does not work on Linux with multiple X screens,
> but this is not a problem, because there one can start stellarium with
> DISPLAY set explicitly like this:
> 
>   DISPLAY=:0.1 stellarium
> ---
> data/default_config.ini.cmake   |  1 +
> src/StelMainView.cpp            | 18 +++++++++++++++++-
> src/gui/ConfigurationDialog.cpp |  9 +++++++--
> 3 files changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/data/default_config.ini.cmake b/data/default_config.ini.cmake
> index 1334a18..40a0017 100644
> --- a/data/default_config.ini.cmake
> +++ b/data/default_config.ini.cmake
> @@ -10,6 +10,7 @@ TimeZoneConfiguration               = true
> 
> [video]
> fullscreen                          = true
> +screenNumber                        = 0
> screen_w                            = 1024
> screen_h                            = 768
> screen_x                            = 0
> diff --git a/src/StelMainView.cpp b/src/StelMainView.cpp
> index b798af8..027f04b 100644
> --- a/src/StelMainView.cpp
> +++ b/src/StelMainView.cpp
> @@ -38,6 +38,8 @@
> #else
> #include <QGLWidget>
> #endif
> +#include <QApplication>
> +#include <QDesktopWidget>
> #include <QGuiApplication>
> #include <QFileInfo>
> #include <QIcon>
> @@ -467,8 +469,22 @@ void StelMainView::init(QSettings* conf)
>       // Without this, the screen is not shown on a Mac + we should use 
> resize() for correct work of fullscreen/windowed mode switch. --AW WTF???
>       resize(size);
> 
> +     QDesktopWidget *desktop = QApplication::desktop();
> +     int screen = conf->value("video/screenNumber", 0).toInt();
> +     if (screen < 0 || screen >= desktop->screenCount())
> +     {
> +             qWarning() << "WARNING: screen" << screen << "not found";
> +             screen = 0;
> +     }
> +     QRect screenGeom = desktop->screenGeometry(screen);
> +
>       if (fullscreen)
>       {
> +             // The fullscreen window appears on screen where is the 
> majority of
> +             // the normal window. So we first resize (shrink) the normal 
> window
> +             // to screen area.
> +             move(screenGeom.x(), screenGeom.y());
> +             resize(screenGeom.width(), screenGeom.height());
>               setFullScreen(true);
>       }
>       else
> @@ -476,7 +492,7 @@ void StelMainView::init(QSettings* conf)
>               setFullScreen(false);
>               int x = conf->value("video/screen_x", 0).toInt();
>               int y = conf->value("video/screen_y", 0).toInt();
> -             move(x, y);
> +             move(x + screenGeom.x(), y + screenGeom.y());
>       }
> 
>       flagInvertScreenShotColors = 
> conf->value("main/invert_screenshots_colors", false).toBool();
> diff --git a/src/gui/ConfigurationDialog.cpp b/src/gui/ConfigurationDialog.cpp
> index 3cb1ef6..3ae2f3e 100644
> --- a/src/gui/ConfigurationDialog.cpp
> +++ b/src/gui/ConfigurationDialog.cpp
> @@ -65,6 +65,7 @@
> #include <QFileDialog>
> #include <QComboBox>
> #include <QDir>
> +#include <QDesktopWidget>
> 
> ConfigurationDialog::ConfigurationDialog(StelGui* agui, QObject* parent)
>       : StelDialog(parent)
> @@ -708,15 +709,19 @@ void ConfigurationDialog::saveCurrentViewOptions()
>       conf->setValue("main/screenshot_dir", StelFileMgr::getScreenshotDir());
>       conf->setValue("main/invert_screenshots_colors", 
> StelMainView::getInstance().getFlagInvertScreenShotColors());
> 
> +     int screenNum = 
> qApp->desktop()->screenNumber(&StelMainView::getInstance());
> +     conf->setValue("video/screenNumber", screenNum);
> +
>       // full screen and window size
>       conf->setValue("video/fullscreen", 
> StelMainView::getInstance().isFullScreen());
>       if (!StelMainView::getInstance().isFullScreen())
>       {
> +             QRect screenGeom = 
> QApplication::desktop()->screenGeometry(screenNum);
>               QWidget& mainWindow = StelMainView::getInstance();
>               conf->setValue("video/screen_w", mainWindow.size().width());
>               conf->setValue("video/screen_h", mainWindow.size().height());
> -             conf->setValue("video/screen_x", mainWindow.x());
> -             conf->setValue("video/screen_y", mainWindow.y());
> +             conf->setValue("video/screen_x", mainWindow.x() - 
> screenGeom.x());
> +             conf->setValue("video/screen_y", mainWindow.y() - 
> screenGeom.y());
>       }
> 
>       // clear the restore defaults flag if it is set.
> --
> 2.1.4
> 
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Stellarium-pubdevel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Stellarium-pubdevel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stellarium-pubdevel

Reply via email to