From alan.schmitt at polytechnique.org Mon Sep 6 11:53:49 2010 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Mon, 6 Sep 2010 17:53:49 +0200 Subject: [Unison-hackers] Command line arguments and OS X GUI In-Reply-To: <2BE7D519-46D8-4D9E-9BFA-E3F5B1DE758E@cis.upenn.edu> References: <4BE3FB04.3030100@strank.info> <4BE40B86.7030609@strank.info> <84B1348A-330A-470E-B90C-E3CEB8DAA121@polytechnique.org> <2BE7D519-46D8-4D9E-9BFA-E3F5B1DE758E@cis.upenn.edu> Message-ID: On 28 juil. 2010, at 15:21, Benjamin C. Pierce wrote: >> Should we try then to fix the GUI, or to change the tutorial? > > Seems like fixing the GUI is the right thing to do, and probably pretty easy (for someone that knows their way around that code a little)... So I identified what needs to be done to fix this, but I'm not comfortable around the Objective C link to OCaml code to actually do it. The problem: when roots are given on the command line, the profile chooser is still opened. The reason: when the command line is parsed, the roots encountered are stored by a call to "Globals.setRawRoots" (in uimacbridgenew.ml, unisonInit0). If there is a profile, it is checked whether it exists then it is returned. The Objective C code only tests whether a profile is returned, and opens the profile chooser otherwise. The solution: check whether roots were set. Now I don't know how to access Globals.rawRoots in Objective C (and match whether it's the empty list). Alternatively, I could create a function on the ml side that does the check and returns a boolean. It's probably simpler, but I need to understand how to add these callbacks. Thoughts? Alan From schmitta at seas.upenn.edu Mon Sep 6 12:37:04 2010 From: schmitta at seas.upenn.edu (schmitta at seas.upenn.edu) Date: Mon, 6 Sep 2010 12:37:04 -0400 Subject: [Unison-hackers] [unison-svn] r463 - in trunk/src: . uimacnew/uimacnew.xcodeproj uimacnew09 uimacnew09/uimacnew.xcodeproj Message-ID: <201009061637.o86Gb486006458@yaws.seas.upenn.edu> Author: schmitta Date: 2010-09-06 12:37:04 -0400 (Mon, 06 Sep 2010) New Revision: 463 Modified: trunk/src/uimacbridgenew.ml trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj trunk/src/uimacnew09/MyController.m trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj Log: the OS X command line tool is now able to take roots on the command line when no profile is specified. This change has only been implemented in uimacnew09. Modified: trunk/src/uimacbridgenew.ml =================================================================== --- trunk/src/uimacbridgenew.ml 2010-07-24 14:07:55 UTC (rev 462) +++ trunk/src/uimacbridgenew.ml 2010-09-06 16:37:04 UTC (rev 463) @@ -187,29 +187,43 @@ ;; Callback.register "unisonInit0" unisonInit0;; +(* Utility function to tell the UI whether roots were set *) + +let areRootsSet () = + match Globals.rawRoots() with + | [] -> false + | _ -> true +;; +Callback.register "areRootsSet" areRootsSet;; + + (* The first time we load preferences, we also read the command line arguments; if we re-load prefs (because the user selected a new profile) we ignore the command line *) let firstTime = ref(true) -(* After figuring out the profile name *) +(* After figuring out the profile name. If the profileName is the empty + string, it means that only the roots were specified on the command + line *) let do_unisonInit1 profileName = (* Load the profile and command-line arguments *) (* Restore prefs to their default values, if necessary *) if not !firstTime then Prefs.resetToDefaults(); - (* Tell the preferences module the name of the profile *) - Prefs.profileName := Some(profileName); + if profileName <> "" then begin + (* Tell the preferences module the name of the profile *) + Prefs.profileName := Some(profileName); - (* If the profile does not exist, create an empty one (this should only - happen if the profile is 'default', since otherwise we will already - have checked that the named one exists). *) - if not(System.file_exists (Prefs.profilePathname profileName)) then - Prefs.addComment "Unison preferences file"; + (* If the profile does not exist, create an empty one (this should only + happen if the profile is 'default', since otherwise we will already + have checked that the named one exists). *) + if not(System.file_exists (Prefs.profilePathname profileName)) then + Prefs.addComment "Unison preferences file"; - (* Load the profile *) - (Trace.debug "" (fun() -> Util.msg "about to load prefs"); - Prefs.loadTheFile()); + (* Load the profile *) + (Trace.debug "" (fun() -> Util.msg "about to load prefs"); + Prefs.loadTheFile()) + end; (* Parse the command line. This will temporarily override settings from the profile. *) Modified: trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj =================================================================== --- trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj 2010-07-24 14:07:55 UTC (rev 462) +++ trunk/src/uimacnew/uimacnew.xcodeproj/project.pbxproj 2010-09-06 16:37:04 UTC (rev 463) @@ -560,6 +560,8 @@ 2A3C3F290992245300E404E9 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", @@ -586,6 +588,7 @@ ); PREBINDING = NO; PRODUCT_NAME = Unison; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wmost", @@ -600,6 +603,8 @@ 2A3C3F2A0992245300E404E9 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", @@ -623,6 +628,7 @@ ); PREBINDING = NO; PRODUCT_NAME = Unison; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wmost", @@ -637,6 +643,8 @@ 2A3C3F2B0992245300E404E9 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_64_BIT_PRE_XCODE_3_1 = x86_64; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", "$(SRCROOT)", @@ -657,6 +665,7 @@ ); PREBINDING = NO; PRODUCT_NAME = Unison; + SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk"; SECTORDER_FLAGS = ""; WARNING_CFLAGS = ( "-Wmost", Modified: trunk/src/uimacnew09/MyController.m =================================================================== --- trunk/src/uimacnew09/MyController.m 2010-07-24 14:07:55 UTC (rev 462) +++ trunk/src/uimacnew09/MyController.m 2010-09-06 16:37:04 UTC (rev 463) @@ -108,7 +108,15 @@ [versionText setStringValue:ocamlCall("S", "unisonGetVersion")]; /* Command-line processing */ - OCamlValue *clprofile = (id)ocamlCall("@", "unisonInit0"); + OCamlValue *clprofile = (id)ocamlCall("@", "unisonInit0"); + BOOL areRootsSet = (long)ocamlCall("i@", "areRootsSet") ? YES : NO; + if (areRootsSet) { + NSLog(@"Roots are on the command line"); + } + else { + NSLog(@"Roots are not set on the command line"); + } + /* Add toolbar */ toolbar = [[[UnisonToolbar alloc] @@ -130,6 +138,12 @@ /* Start the connection */ [self connect:profileName]; } + else if (areRootsSet) { + /* If invoked from terminal we need to bring the app to the front */ + [NSApp activateIgnoringOtherApps:YES]; + /* Start the connection with the empty profile name, indicating roots only */ + [self connect:@""]; + } else { /* If invoked from terminal we need to bring the app to the front */ [NSApp activateIgnoringOtherApps:YES]; Modified: trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj =================================================================== --- trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj 2010-07-24 14:07:55 UTC (rev 462) +++ trunk/src/uimacnew09/uimacnew.xcodeproj/project.pbxproj 2010-09-06 16:37:04 UTC (rev 463) @@ -576,6 +576,7 @@ 2A3C3F290992245300E404E9 /* Development */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", @@ -619,6 +620,7 @@ 2A3C3F2A0992245300E404E9 /* Deployment */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", @@ -659,6 +661,7 @@ 2A3C3F2B0992245300E404E9 /* Default */ = { isa = XCBuildConfiguration; buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; FRAMEWORK_SEARCH_PATHS = ( "$(FRAMEWORK_SEARCH_PATHS)", "$(SRCROOT)", From alan.schmitt at polytechnique.org Mon Sep 6 12:35:31 2010 From: alan.schmitt at polytechnique.org (Alan Schmitt) Date: Mon, 6 Sep 2010 18:35:31 +0200 Subject: [Unison-hackers] Command line arguments and OS X GUI In-Reply-To: References: <4BE3FB04.3030100@strank.info> <4BE40B86.7030609@strank.info> <84B1348A-330A-470E-B90C-E3CEB8DAA121@polytechnique.org> <2BE7D519-46D8-4D9E-9BFA-E3F5B1DE758E@cis.upenn.edu> Message-ID: On 6 sept. 2010, at 17:53, Alan Schmitt wrote: > On 28 juil. 2010, at 15:21, Benjamin C. Pierce wrote: > >>> Should we try then to fix the GUI, or to change the tutorial? >> >> Seems like fixing the GUI is the right thing to do, and probably pretty easy (for someone that knows their way around that code a little)... > > So I identified what needs to be done to fix this, but I'm not comfortable around the Objective C link to OCaml code to actually do it. > > The problem: when roots are given on the command line, the profile chooser is still opened. > The reason: when the command line is parsed, the roots encountered are stored by a call to "Globals.setRawRoots" (in uimacbridgenew.ml, unisonInit0). If there is a profile, it is checked whether it exists then it is returned. The Objective C code only tests whether a profile is returned, and opens the profile chooser otherwise. > The solution: check whether roots were set. > > Now I don't know how to access Globals.rawRoots in Objective C (and match whether it's the empty list). > > Alternatively, I could create a function on the ml side that does the check and returns a boolean. It's probably simpler, but I need to understand how to add these callbacks. I finally went that root, and it's working. I've only made the change in uimacnew09 for the moment. I'd like other people to give their opinion on the changes before putting it in other uis. Alan From daniel.blueman at gmail.com Mon Sep 6 17:14:15 2010 From: daniel.blueman at gmail.com (Daniel J Blueman) Date: Mon, 6 Sep 2010 22:14:15 +0100 Subject: [Unison-hackers] unison overdrawing UI... In-Reply-To: References: Message-ID: Using unison-gtk 2.32.52, I am seeing a significant amount of time spent by Xorg redrawing the GTK UI. The processor usage breaks down as (on a multi-core system): 67% processor time unison, 53% Xorg, 8% ssh. From bogus@does.not.exist.com Thu Sep 2 12:11:44 2010 From: bogus@does.not.exist.com () Date: Thu, 02 Sep 2010 16:11:44 -0000 Subject: No subject Message-ID: times/s. Though this wouldn't initially seem excessive, but some X servers (eg radeon) do not accelerate some GTK operations efficiently, or on laptop GPUs (in my case), draw performance is comparatively poor; this will have high impact over an X TCP connection too. Since the UI is not changing when the drawing occurs, it is redundant. Is there plan to address this in some way? Many thanks, =A0Daniel -- Daniel J Blueman From Jerome.Vouillon at pps.jussieu.fr Thu Sep 9 05:11:45 2010 From: Jerome.Vouillon at pps.jussieu.fr (Jerome Vouillon) Date: Thu, 9 Sep 2010 11:11:45 +0200 Subject: [Unison-hackers] unison overdrawing UI... In-Reply-To: References: Message-ID: <20100909091145.GB28640@pps.jussieu.fr> On Mon, Sep 06, 2010 at 10:14:15PM +0100, Daniel J Blueman wrote: > Using unison-gtk 2.32.52, I am seeing a significant amount of time > spent by Xorg redrawing the GTK UI. The processor usage breaks down as > (on a multi-core system): 67% processor time unison, 53% Xorg, 8% ssh. > > From ltrace profiling, gtk_clist_set_text is being called at ~33 > times/s. Though this wouldn't initially seem excessive, but some X > servers (eg radeon) do not accelerate some GTK operations efficiently, > or on laptop GPUs (in my case), draw performance is comparatively > poor; this will have high impact over an X TCP connection too. > > Since the UI is not changing when the drawing occurs, it is redundant. > Is there plan to address this in some way? That should be fixed in Unison 2.40 -- Jerome