]> source.dussan.org Git - tigervnc.git/commitdiff
Added a standard -geometry command line option. Such an option is
authorPeter Åstrand <astrand@cendio.se>
Mon, 27 Aug 2012 07:28:08 +0000 (07:28 +0000)
committerPeter Åstrand <astrand@cendio.se>
Mon, 27 Aug 2012 07:28:08 +0000 (07:28 +0000)
actually already documented on the man page.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4972 3789f03b-4d11-0410-bbf8-ca57d06f2519

vncviewer/CMakeLists.txt
vncviewer/DesktopWindow.cxx
vncviewer/parameters.cxx
vncviewer/parameters.h

index c1facc67c6408fdccf147dff8efa25fb711b2539..4348b85d38b1b61ad2dff7c8acd9a8b3362dd000 100644 (file)
@@ -45,13 +45,53 @@ else()
   add_executable(vncviewer ${VNCVIEWER_SOURCES})
 endif()
 
-target_link_libraries(vncviewer rfb network rdr os Xregion ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
 
-# When building with GnuTLS, librdr depends on ws2_32, so in order to make
-# MinGW happy, we need to put ws2_32 in librdr's target_link_libraries string,
-# not here.
-if(NOT GNUTLS_FOUND AND WIN32)
-  target_link_libraries(vncviewer ws2_32)
+# XXX: Cendio hack
+#target_link_libraries(vncviewer rfb network rdr os Xregion ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
+#
+## When building with GnuTLS, librdr depends on ws2_32, so in order to make
+## MinGW happy, we need to put ws2_32 in librdr's target_link_libraries string,
+## not here.
+#if(NOT GNUTLS_FOUND AND WIN32)
+#  target_link_libraries(vncviewer ws2_32)
+#endif()
+
+target_link_libraries(vncviewer -nodefaultlibs rfb network rdr os Xregion)
+
+if(APPLE)
+  target_link_libraries(vncviewer "-framework Carbon" "-framework Cocoa" "-framework ApplicationServices")
+endif()
+
+if(UNIX AND NOT APPLE)
+  # Needed to load icon files
+  target_link_libraries(vncviewer -Wl,-Bstatic ${FLTK_IMAGES_LIBRARY} png -Wl,-Bdynamic)
+endif()
+
+target_link_libraries(vncviewer -Wl,-Bstatic ${FLTK_BASE_LIBRARY} -Wl,-Bdynamic)
+
+if(WIN32)
+  target_link_libraries(vncviewer -Wl,-Bstatic ${GETTEXT_LIBRARIES} ${ICONV_LIBRARIES} -Wl,-Bdynamic)
+elseif(APPLE)
+  target_link_libraries(vncviewer -Wl,-Bstatic ${GETTEXT_LIBRARIES} -Wl,-Bdynamic ${ICONV_LIBRARIES})
+else()
+  if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+    # XXX: Cendio hack: Add rpath to find libXfixes on Solaris without LD_LIBRARY_PATH.
+    # XXX: Cendio hack: libXft is broken on at least our servers
+    # XXX: Cendio hack: In theory, we must add freetype. However, in practice this does not work, since it is not found,
+    # since it's in /usr/sparc-sun-solaris2.10/sys-root/usr/sfw/lib/. It works if we DONT specify it, though. 
+    target_link_libraries(vncviewer ${X11_Xcursor_LIB} ${X11_Xfixes_LIB} /usr/sparc-sun-solaris2.10/sys-root/usr/X11/lib/libXinerama.so -Wl,-Bstatic Xft -Wl,-Bdynamic fontconfig Xext -R/usr/sfw/lib)
+  else()
+    target_link_libraries(vncviewer -Wl,-Bstatic ${X11_Xcursor_LIB} ${X11_Xfixes_LIB} Xft fontconfig expat freetype Xrender Xext Xinerama -Wl,-Bdynamic)
+  endif()
+  target_link_libraries(vncviewer X11 m )
+endif()
+
+target_link_libraries(vncviewer libstdc++.a gcc gcc_eh)
+
+if(WIN32)
+  target_link_libraries(vncviewer ws2_32 comctl32 mingw32 moldname mingwex msvcrt kernel32 gcc)
+else()
+  target_link_libraries(vncviewer c)
 endif()
 
 install(TARGETS vncviewer DESTINATION ${BIN_DIR})
index 463adf365a7bce13d3d88607d8fd7d9e425c5247..1693ab5530244e8cf50a5d3866aef235594393f5 100644 (file)
@@ -88,12 +88,42 @@ DesktopWindow::DesktopWindow(int w, int h, const char *name,
   } else
 #endif
   {
+
+    int geom_x = 0, geom_y = 0;
+    if (geometry.hasBeenSet()) {
+      int matched;
+      matched = sscanf(geometry.getValueStr(), "+%d+%d", &geom_x, &geom_y);
+      if (matched == 2) {
+       force_position(1);
+      } else {
+       int geom_w, geom_h;
+       matched = sscanf(geometry.getValueStr(), "%dx%d+%d+%d", &geom_w, &geom_h, &geom_x, &geom_y);
+       switch (matched) {
+       case 4:
+         force_position(1);
+         /* fall through */
+       case 2:
+         w = geom_w;
+         h = geom_h;
+       default:
+         vlog.error("Invalid geometry specified!");    
+       }
+      }
+    }
+    
     // If we are creating a window which is equal to the size on the
     // screen on X11, many WMs will treat this as a legacy fullscreen
     // request. This is not what we want. Besides, it doesn't really
     // make sense to try to create a window which is larger than the
     // available work space. 
-    size(__rfbmin(w, Fl::w()), __rfbmin(h, Fl::h()));
+    w = __rfbmin(w, Fl::w());
+    h = __rfbmin(h, Fl::h());
+
+    if (force_position()) {
+      resize(geom_x, geom_y, w, h);
+    } else {
+      size(w, h);
+    }
   }
 
   show();
index 4c5a3dd6a520100ad17e87f80af1ffd978e23a83..9a3bcd25f6ba43994e2bdcd851bd8004fca1e7ab 100644 (file)
@@ -100,6 +100,8 @@ BoolParameter fullScreenAllMonitors("FullScreenAllMonitors",
 StringParameter desktopSize("DesktopSize",
                             "Reconfigure desktop size on the server on "
                             "connect (if possible)", "");
+StringParameter geometry("geometry",
+                        "Specify size and position of viewer window", "");
 BoolParameter remoteResize("RemoteResize",
                            "Dynamically resize the remote desktop size as "
                            "the size of the local client window changes. "
@@ -155,6 +157,7 @@ VoidParameter* parameterArray[] = {
 #endif // HAVE_FLTK_FULLSCREEN_SCREENS
 #endif // HAVE_FLTK_FULLSCREEN
   &desktopSize,
+  &geometry,
   &remoteResize,
   &viewOnly,
   &shared,
index 4fa989ffcc23ff5d6670667fafb160591d4d4334..d7144a4bb2955a3e2e6be78b8b3f2b7e08efb95b 100644 (file)
@@ -46,6 +46,7 @@ extern rfb::BoolParameter fullScreenAllMonitors;
 #endif // HAVE_FLTK_FULLSCREEN_SCREENS
 #endif // HAVE_FLTK_FULLSCREEN
 extern rfb::StringParameter desktopSize;
+extern rfb::StringParameter geometry;
 extern rfb::BoolParameter remoteResize;
 
 extern rfb::BoolParameter viewOnly;