summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-12 16:36:04 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-01-12 16:36:04 -0600
commit18f6f27f9f340d56b12b8f7bc87ae410d595d1b1 (patch)
tree400aa522ea595a73f69d2a6f32e68b1a940984c7
parentbbae7554f1dcb98d94bd73ec9bce07f0e99e21d0 (diff)
downloadtdebase-18f6f27f9f340d56b12b8f7bc87ae410d595d1b1.tar.gz
tdebase-18f6f27f9f340d56b12b8f7bc87ae410d595d1b1.zip
Fix tdm initial dialog display when randr changes the screen configuration on startup
-rw-r--r--tdm/kfrontend/kgapp.cpp63
-rw-r--r--tdm/kfrontend/kgapp.h2
2 files changed, 37 insertions, 28 deletions
diff --git a/tdm/kfrontend/kgapp.cpp b/tdm/kfrontend/kgapp.cpp
index 120e20cb4..bd96766b9 100644
--- a/tdm/kfrontend/kgapp.cpp
+++ b/tdm/kfrontend/kgapp.cpp
@@ -71,6 +71,7 @@ bool argb_visual_available = false;
bool has_twin = false;
bool is_themed = false;
bool trinity_desktop_lock_use_sak = TRUE;
+TQPoint primaryScreenPosition;
static int
ignoreXError( Display *dpy ATTR_UNUSED, XErrorEvent *event ATTR_UNUSED )
@@ -90,23 +91,21 @@ sigAlarm( int )
GreeterApp::GreeterApp()
{
- pingInterval = _isLocal ? 0 : _pingInterval;
- if (pingInterval) {
- struct sigaction sa;
- sigemptyset( &sa.sa_mask );
- sa.sa_flags = 0;
- sa.sa_handler = sigAlarm;
- sigaction( SIGALRM, &sa, 0 );
- alarm( pingInterval * 70 ); // sic! give the "proper" pinger enough time
- startTimer( pingInterval * 60000 );
- }
+ init();
+}
- TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
- connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
+GreeterApp::GreeterApp(Display *dpy) : KApplication(dpy)
+{
+ init();
}
GreeterApp::GreeterApp(Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap) : KApplication(dpy, visual, colormap)
{
+ init();
+}
+
+void GreeterApp::init()
+{
pingInterval = _isLocal ? 0 : _pingInterval;
if (pingInterval) {
struct sigaction sa;
@@ -229,8 +228,6 @@ kg_main( const char *argv0 )
delete tsak;
}
-#ifdef HAVE_XCOMPOSITE
- // Begin ARGB initialization
XSetErrorHandler( ignoreXError );
argb_visual_available = false;
char *display = 0;
@@ -241,6 +238,8 @@ kg_main( const char *argv0 )
exit( 1 );
}
+#ifdef HAVE_XCOMPOSITE
+ // Begin ARGB initialization
int screen = DefaultScreen( dpyi );
Colormap colormap = 0;
Visual *visual = 0;
@@ -273,27 +272,17 @@ kg_main( const char *argv0 )
app = new GreeterApp(dpyi, Qt::HANDLE( visual ), Qt::HANDLE( colormap ));
}
else {
- app = new GreeterApp();
+ app = new GreeterApp(dpyi);
}
// End ARGB initialization
#else
- GreeterApp *app = new GreeterApp();
+ GreeterApp *app = new GreeterApp(dpyi);
#endif
- XSetIOErrorHandler( xIOErr );
- TQString login_user;
- TQString login_session_wm;
-
- Display *dpy = tqt_xdisplay();
-
- if (!_GUIStyle.isEmpty()) {
- app->setStyle( _GUIStyle );
- }
-
// Load up systemwide display settings
#ifdef WITH_XRANDR
KRandrSimpleAPI *randrsimple = new KRandrSimpleAPI();
- TQPoint primaryScreenPosition = randrsimple->applyStartupDisplayConfiguration(KDE_CONFDIR);
+ primaryScreenPosition = randrsimple->applyStartupDisplayConfiguration(KDE_CONFDIR);
randrsimple->applyHotplugRules(KDE_CONFDIR);
delete randrsimple;
#endif
@@ -306,7 +295,25 @@ kg_main( const char *argv0 )
TQString iccCommand = TQString("/usr/bin/xcalib ");
iccCommand += iccconfig.readEntry("ICCFile");
iccCommand += TQString(" &");
- system(iccCommand.ascii());
+ if (system(iccCommand.ascii()) < 0) {
+ printf("WARNING: Unable to execute command \"%s\"\n\r", iccCommand.ascii());
+ }
+ }
+
+ // Make sure TQt is aware of the screen geometry changes before any dialogs are created
+ XSync(tqt_xdisplay(), false);
+ app->processEvents();
+ TQRect screenRect = TQApplication::desktop()->screenGeometry();
+ TQCursor::setPos(screenRect.center().x(), screenRect.center().y());
+
+ XSetIOErrorHandler( xIOErr );
+ TQString login_user;
+ TQString login_session_wm;
+
+ Display *dpy = tqt_xdisplay();
+
+ if (!_GUIStyle.isEmpty()) {
+ app->setStyle( _GUIStyle );
}
_colorScheme = locate( "data", "kdisplay/color-schemes/" + _colorScheme + ".kcsrc" );
diff --git a/tdm/kfrontend/kgapp.h b/tdm/kfrontend/kgapp.h
index 4769ff65a..41a1dcabd 100644
--- a/tdm/kfrontend/kgapp.h
+++ b/tdm/kfrontend/kgapp.h
@@ -35,6 +35,7 @@ class GreeterApp : public KApplication {
public:
GreeterApp();
+ GreeterApp(Display *dpy);
GreeterApp(Display *dpy, Qt::HANDLE visual, Qt::HANDLE colormap);
virtual bool x11EventFilter( XEvent * );
@@ -48,6 +49,7 @@ class GreeterApp : public KApplication {
void deviceChanged( TDEGenericDevice * );
private:
+ void init();
int pingInterval;
};