]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - radiant/multimon.cpp
Revert partially (manual) "reformat code! now the code is only ugly on the *inside*"
[xonotic/netradiant.git] / radiant / multimon.cpp
index 99d632040df89862fea6a12ee02c2d6262e2b3b7..9a4a4f22a2d572bd9bcf15ffb041c4866554e09e 100644 (file)
 
 multimon_globals_t g_multimon_globals;
 
-LatchedValue<bool> g_Multimon_enableSysMenuPopups(false, "Floating windows sysmenu icons");
-
-void MultiMonitor_constructPreferences(PreferencesPage &page)
-{
-    ui::CheckButton primary_monitor = page.appendCheckBox("Multi Monitor", "Start on Primary Monitor",
-                                                          g_multimon_globals.m_bStartOnPrimMon);
-    ui::CheckButton popup = page.appendCheckBox(
-            "", "Disable system menu on popup windows",
-            make_property(g_Multimon_enableSysMenuPopups)
-    );
-    Widget_connectToggleDependency(popup, primary_monitor);
+LatchedValue<bool> g_Multimon_enableSysMenuPopups( false, "Floating windows sysmenu icons" );
+
+void MultiMonitor_constructPreferences( PreferencesPage& page ){
+       ui::CheckButton primary_monitor = page.appendCheckBox( "Multi Monitor", "Start on Primary Monitor", g_multimon_globals.m_bStartOnPrimMon );
+       ui::CheckButton popup = page.appendCheckBox(
+               "", "Disable system menu on popup windows",
+               mkImportExportCallback( g_Multimon_enableSysMenuPopups )
+               );
+       Widget_connectToggleDependency( popup, primary_monitor );
 }
 
 #include "preferencesystem.h"
@@ -47,58 +45,54 @@ void MultiMonitor_constructPreferences(PreferencesPage &page)
 
 #include <gdk/gdk.h>
 
-namespace {
-    GdkRectangle primaryMonitor;
+namespace
+{
+GdkRectangle primaryMonitor;
 }
 
-void PositionWindowOnPrimaryScreen(WindowPosition &position)
-{
-    if (position.w >= primaryMonitor.width - 12) {
-        position.w = primaryMonitor.width - 12;
-    }
-    if (position.h >= primaryMonitor.height - 24) {
-        position.h = primaryMonitor.height - 48;
-    }
-    if (position.x <= primaryMonitor.x || position.x + position.w >= (primaryMonitor.x + primaryMonitor.width) - 12) {
-        position.x = primaryMonitor.x + 6;
-    }
-    if (position.y <= primaryMonitor.y || position.y + position.h >= (primaryMonitor.y + primaryMonitor.height) - 48) {
-        position.y = primaryMonitor.y + 24;
-    }
+void PositionWindowOnPrimaryScreen( WindowPosition& position ){
+       if ( position.w >= primaryMonitor.width - 12 ) {
+               position.w = primaryMonitor.width - 12;
+       }
+       if ( position.h >= primaryMonitor.height - 24 ) {
+               position.h = primaryMonitor.height - 48;
+       }
+       if ( position.x <= primaryMonitor.x || position.x + position.w >= ( primaryMonitor.x + primaryMonitor.width ) - 12 ) {
+               position.x = primaryMonitor.x + 6;
+       }
+       if ( position.y <= primaryMonitor.y || position.y + position.h >= ( primaryMonitor.y + primaryMonitor.height ) - 48 ) {
+               position.y = primaryMonitor.y + 24;
+       }
 }
 
-void MultiMon_Construct()
-{
-    // detect multiple monitors
-
-    GdkScreen *screen = gdk_display_get_default_screen(gdk_display_get_default());
-    gint m = gdk_screen_get_n_monitors(screen);
-    globalOutputStream() << "default screen has " << m << " monitors\n";
-    for (int j = 0; j != m; ++j) {
-        GdkRectangle geom;
-        gdk_screen_get_monitor_geometry(screen, j, &geom);
-        globalOutputStream() << "monitor " << j << " geometry: " << geom.x << ", " << geom.y << ", " << geom.width
-                             << ", " << geom.height << "\n";
-        if (j == 0) {
-            // I am making the assumption that monitor 0 is always the primary monitor on win32. Tested on WinXP with gtk+-2.4.
-            primaryMonitor = geom;
-        }
-    }
-
-    if (m > 1) {
-        g_multimon_globals.m_bStartOnPrimMon = true;
-    }
-
-    GlobalPreferenceSystem().registerPreference("StartOnPrimMon",
-                                                make_property_string(g_multimon_globals.m_bStartOnPrimMon));
-    GlobalPreferenceSystem().registerPreference("NoSysMenuPopups",
-                                                make_property_string(g_Multimon_enableSysMenuPopups.m_latched));
-
-    g_Multimon_enableSysMenuPopups.useLatched();
-
-    PreferencesDialog_addInterfacePreferences(makeCallbackF(MultiMonitor_constructPreferences));
+void MultiMon_Construct(){
+       // detect multiple monitors
+
+       GdkScreen* screen = gdk_display_get_default_screen( gdk_display_get_default() );
+       gint m = gdk_screen_get_n_monitors( screen );
+       globalOutputStream() << "default screen has " << m << " monitors\n";
+       for ( int j = 0; j != m; ++j )
+       {
+               GdkRectangle geom;
+               gdk_screen_get_monitor_geometry( screen, j, &geom );
+               globalOutputStream() << "monitor " << j << " geometry: " << geom.x << ", " << geom.y << ", " << geom.width << ", " << geom.height << "\n";
+               if ( j == 0 ) {
+                       // I am making the assumption that monitor 0 is always the primary monitor on win32. Tested on WinXP with gtk+-2.4.
+                       primaryMonitor = geom;
+               }
+       }
+
+       if ( m > 1 ) {
+               g_multimon_globals.m_bStartOnPrimMon = true;
+       }
+
+       GlobalPreferenceSystem().registerPreference( "StartOnPrimMon", make_property_string( g_multimon_globals.m_bStartOnPrimMon ) );
+       GlobalPreferenceSystem().registerPreference( "NoSysMenuPopups", make_property_string( g_Multimon_enableSysMenuPopups.m_latched ) );
+
+       g_Multimon_enableSysMenuPopups.useLatched();
+
+       PreferencesDialog_addInterfacePreferences( makeCallbackF(MultiMonitor_constructPreferences) );
 }
 
-void MultiMon_Destroy()
-{
+void MultiMon_Destroy(){
 }