hi all,
I've had a look at the code and tried to rearrange some of the
commands to make amsn *feel* quicker at the startup.
Unfortunately all the dependencies in reload_files are needed, because
of how the code in gui.tcl is; there were just two that could be
loaded later, but it was too little. What I've done is change the
command order in "amsn" and gui.tcl (proc cmsn_draw_main).
As a side effect if you set aMSN to start in tray it will flash opened
until the bootstrap has finished, so you may not want to apply this
patch anyway, if this is a problem.
A new proc have been added, cmsn_draw_loading, which is more or less a
copy&paste of cmsn_draw_signin; a new key in language files, "loading"
is now expected to exist. This will be shown under the signin image
(you can change this, of course...)
Finally also the "amsn" script itself have been a little rearranged,
and it prints some "loading" info to the console (just a few, doing
this...done; doing that...done) you can remove that if you find it
annoying.
cmsn_draw_offline is now called explictly from "amsn" once that other
"loading/boot" actions have finished (beside the ones of
cmsn_draw_main ;))
Of course the bootstrap process IS NOT faster (it's probably a bit
slower, because of the loading animation) but it should *feel* a
little faster, because the window now appears as soon as it's
possible.
time from first instruction to window shown
~3.262.543
using the patch:
~2.818.730
of course, not so much... btw it would depend on the processor, etc...
hope this helps
bye!
Index: amsn
===================================================================
--- amsn (revisione 7572)
+++ amsn (copia locale)
@@ -96,6 +96,7 @@
### From here we need amsncore, so load it.
############################################################
+
source amsncore.tcl
@@ -166,6 +167,7 @@
}
}
+puts "initial setup done"
proc reload_files { } {
uplevel \#0 {
@@ -200,7 +202,7 @@
source groups.tcl ;# Handle buddy groups
if { [OnDarwin] } {
- source [file join utils macosx applescript ae.tcl];#AppleEvent support
+ #16source [file join utils macosx applescript ae.tcl];#AppleEvent support
}
source alarm.tcl ;# Alarms code (Burger)
@@ -224,29 +226,13 @@
}
}
+puts "loading source files..."
reload_files
+puts "DONE"
+
set initialize_amsn 0
-#///////////////////////////////////////////////////////////////////////
-if { [catch {package require tls}] } {
- # Either tls is not installed, or $auto_path does not point to it.
- # Should now never happen; the check for the presence of tls is made
- # before this point.
-# status_log "Could not find the package tls on this system.\n"
- set tlsinstalled 0
-} else {
- set tlsinstalled 1
-}
-
-#create_dir $HOME
-set log_dir "[file join ${HOME} logs]"
-set webcam_dir "[file join ${HOME} webcam]"
-create_dir $log_dir
-create_dir $webcam_dir
-
-NS create ns -stat d -server [split [::config::getKey start_ns_server] ":"]
-
set family [lindex [::config::getGlobalKey basefont] 0]
set size [lindex [::config::getGlobalKey basefont] 1]
@@ -258,20 +244,48 @@
set allfonts([string tolower $font]) $font
}
+
+
+set ::auto_encoding [encoding system]
+
+if { [::config::getKey encoding] != "auto" } {
+ set_encoding [::config::getKey encoding]
+}
+
+
+puts "drawing main window..."
+cmsn_draw_main
+puts "done."
+
+
# Bye bye hidden files in file dialogs (works fine with Mac even without this).
if {[OnLinux]} {
catch { tk_getOpenFile -w00t } ;# start file dialog with unknown option
set ::tk::dialog::file::showHiddenVar 0
}
-set ::auto_encoding [encoding system]
-if { [::config::getKey encoding] != "auto" } {
- set_encoding [::config::getKey encoding]
+#///////////////////////////////////////////////////////////////////////
+
+if { [catch {package require tls}] } {
+ # Either tls is not installed, or $auto_path does not point to it.
+ # Should now never happen; the check for the presence of tls is made
+ # before this point.
+# status_log "Could not find the package tls on this system.\n"
+ set tlsinstalled 0
+} else {
+ set tlsinstalled 1
}
-cmsn_draw_main
+#create_dir $HOME
+set log_dir "[file join ${HOME} logs]"
+set webcam_dir "[file join ${HOME} webcam]"
+create_dir $log_dir
+create_dir $webcam_dir
+NS create ns -stat d -server [split [::config::getKey start_ns_server] ":"]
+
+
bind all <KeyPress> "set idletime 0"
idleCheck
@@ -292,6 +306,8 @@
}
}
+# CONFIGURATION DONE. LET THE USER CONNECT
+cmsn_draw_offline
update idletasks
init_dock
Index: gui.tcl
===================================================================
--- gui.tcl (revisione 7572)
+++ gui.tcl (copia locale)
@@ -3400,8 +3400,6 @@
proc cmsn_draw_main {} {
global pgBuddy pgBuddyTop pgNews argv0 argv
- create_states_menu .my_menu
- create_other_menus .user_menu .menu_invite
create_main_menu .main_menu
wm title . "[trans title] - [trans offline]"
@@ -3425,7 +3423,61 @@
frame .main.f -class Amsn -relief flat -background white -borderwidth 0
pack .main -fill both -expand true
pack .main.f -expand true -fill both -padx [::skin::getKey buddylistpad] -pady [::skin::getKey buddylistpad] -side top
+
+ #Set the position on the screen and the size for the contact list, from config
+ #Check if the geometry is available :
+ set geometry [::config::getKey wingeometry]
+ set width 0
+ set height 0
+ set x 0
+ set y 0
+ set modified 0
+ regexp {=?(\d+)x(\d+)[+\-](-?\d+)[+\-](-?\d+)} $geometry -> width height x y
+ if {[expr {$width + $x}] > [winfo screenwidth .]} {
+ set modified 1
+ if { [OnMac] } {
+ set x 200
+ } else {
+ set x 0
+ }
+ }
+ if {[expr {$width}] > [winfo screenwidth .]} {
+ set modified 1
+ set width 275
+ }
+ if {[expr {$height + $y}] > [winfo screenheight .]} {
+ set modified 1
+ if { [OnMac] } {
+ set y 200
+ } else {
+ set y 0
+ }
+ }
+ if {[expr {$height}] > [winfo screenheight .]} {
+ set modified 1
+ set height 400
+ }
+ if {$modified == 1} {
+ set geometry ${width}x${height}-${x}+${y}
+ ::config::setKey wingeometry $geometry
+ }
+ catch {wm geometry . $geometry}
+
+ #To avoid the bug of window behind the menu bar on Mac OS X
+ #The menubar's height is 22.
+ if { [OnMac] && [winfo y .] < 22 } {
+ moveinscreen . 30
+ }
+
+ #allow for display updates so window size is correct
+ update idletasks
+ #Draw main window contents
+ cmsn_draw_status
+
+ wm state . normal
+ update
+
if {[::config::getKey withnotebook]} {
# Create the Notebook and initialize the page paths. These
# page paths must be used for adding new widgets to the
@@ -3464,6 +3516,13 @@
$pgBuddy setwidget $pgBuddy.text
+
+ # This is actually a little more than a cmsn_draw_signin copy&paste
+ # Btw works well enough... it is displayed for a little while...
+ cmsn_draw_loading
+ update
+
+
# Initialize the event history
frame .main.eventmenu
combobox::combobox .main.eventmenu.list -editable false -highlightthickness 0 -width 22 -bg #FFFFFF -font splainf -exportselection false
@@ -3472,6 +3531,7 @@
label .main.banner -bd 0 -relief flat -background [::skin::getKey bannerbg]
pack .main.banner -side bottom -fill x
resetBanner
+
#delete F10 binding that crashes amsn
bind all <F10> ""
@@ -3536,9 +3596,12 @@
}
#Draw main window contents
- cmsn_draw_status
- cmsn_draw_offline
+ #cmsn_draw_status
+ create_states_menu .my_menu
+ create_other_menus .user_menu .menu_invite
+
+
if { [OnWin] } {
catch {wm iconbitmap . [::skin::GetSkinFile winicons msn.ico]}
catch {wm iconbitmap . -default [::skin::GetSkinFile winicons msn.ico]}
@@ -3547,58 +3610,11 @@
catch {wm iconmask . @[::skin::GetSkinFile pixmaps amsnmask.xbm]}
}
- update
-
- #Set the position on the screen and the size for the contact list, from config
- #Check if the geometry is available :
- set geometry [::config::getKey wingeometry]
- set width 0
- set height 0
- set x 0
- set y 0
- set modified 0
- regexp {=?(\d+)x(\d+)[+\-](-?\d+)[+\-](-?\d+)} $geometry -> width height x y
- if {[expr {$width + $x}] > [winfo screenwidth .]} {
- set modified 1
- if { [OnMac] } {
- set x 200
- } else {
- set x 0
- }
- }
- if {[expr {$width}] > [winfo screenwidth .]} {
- set modified 1
- set width 275
- }
- if {[expr {$height + $y}] > [winfo screenheight .]} {
- set modified 1
- if { [OnMac] } {
- set y 200
- } else {
- set y 0
- }
- }
- if {[expr {$height}] > [winfo screenheight .]} {
- set modified 1
- set height 400
- }
- if {$modified == 1} {
- set geometry ${width}x${height}-${x}+${y}
- ::config::setKey wingeometry $geometry
- }
- catch {wm geometry . $geometry}
-
- #To avoid the bug of window behind the menu bar on Mac OS X
- #The menubar's height is 22.
- if { [OnMac] && [winfo y .] < 22 } {
- moveinscreen . 30
- }
-
- #allow for display updates so window size is correct
- update idletasks
-
+ #update
+ #cmsn_draw_offline
+
#Unhide main window now that it has finished being created
- wm state . normal
+ #wm state . normal
}
#///////////////////////////////////////////////////////////////////////
@@ -4116,7 +4132,6 @@
#///////////////////////////////////////////////////////////////////////
-
#///////////////////////////////////////////////////////////////////////
proc cmsn_draw_offline {} {
bind . <Configure> ""
@@ -4270,9 +4285,43 @@
}
#///////////////////////////////////////////////////////////////////////
+########################################################################
+proc cmsn_draw_loading {} {
+ bind . <Configure> ""
+ global pgBuddy pgBuddyTop eventdisconnected
+ set eventdisconnected 1
+
+ wm title . "[trans title] - [::config::getKey login]"
+
+
+ pack forget $pgBuddyTop
+ $pgBuddy.text configure -state normal -font splainf
+
+ $pgBuddy.text delete 0.0 end
+ $pgBuddy.text tag conf loading -fore #000000 \
+ -font sboldf -justify center
+ #$pgBuddy.text insert end "\n\n\n\n\n\n\n"
+ $pgBuddy.text insert end "\n\n\n\n\n"
+
+ catch {
+ $pgBuddy.text insert end " " loading
+ $pgBuddy.text image create end -image [::skin::loadPixmap loganim]
+ $pgBuddy.text insert end " " loading
+
+ }
+
+ $pgBuddy.text insert end "\n\n"
+ $pgBuddy.text insert end "[trans loading]..." loading
+ $pgBuddy.text configure -state disabled
+
+}
#///////////////////////////////////////////////////////////////////////
+
+
+
+#///////////////////////////////////////////////////////////////////////
proc cmsn_draw_signin {} {
bind . <Configure> ""
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Amsn-devel mailing list
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel