diff --git a/collects/drracket/private/unit.rkt b/collects/drracket/private/unit.rkt index 8af3376dff..00deb4df29 100644 --- a/collects/drracket/private/unit.rkt +++ b/collects/drracket/private/unit.rkt @@ -2974,22 +2974,33 @@ module browser threading seems wrong. (update-close-menu-item-shortcut (file-menu:get-close-item))) (define/private (update-close-tab-menu-item-shortcut item) - (let ([just-one? (and (pair? tabs) (null? (cdr tabs)))]) - (send item set-label (if just-one? - (string-constant close-tab) - (string-constant close-tab-amp))) - (when (preferences:get 'framework:menu-bindings) - (send item set-shortcut (if just-one? #f #\w))))) + (define just-one? (and (pair? tabs) (null? (cdr tabs)))) + (send item set-label (if just-one? + (string-constant close-tab) + (string-constant close-tab-amp))) + (when (preferences:get 'framework:menu-bindings) + (send item set-shortcut (if just-one? #f #\w)))) (define/private (update-close-menu-item-shortcut item) - (let ([just-one? (and (pair? tabs) (null? (cdr tabs)))]) - (send item set-label (if just-one? - (string-constant close-menu-item) - (string-constant close))) - (when (preferences:get 'framework:menu-bindings) - (send item set-shortcut-prefix (if just-one? - (get-default-shortcut-prefix) - (cons 'shift (get-default-shortcut-prefix))))))) + (cond + [(eq? (system-type) 'linux) + (send item set-label (string-constant close-menu-item))] + [else + (define just-one? (and (pair? tabs) (null? (cdr tabs)))) + (send item set-label (if just-one? + (string-constant close-window-menu-item) + (string-constant close-window))) + (when (preferences:get 'framework:menu-bindings) + (send item set-shortcut-prefix (if just-one? + (get-default-shortcut-prefix) + (cons 'shift (get-default-shortcut-prefix)))))])) + + (define/override (file-menu:close-callback item control) + (define just-one? (and (pair? tabs) (null? (cdr tabs)))) + (if (and (eq? (system-type) 'linux) + (not just-one?)) + (close-current-tab) + (super file-menu:close-callback item control))) ;; offer-to-save-file : path -> void ;; bring the tab that edits the file named by `path' to the front @@ -3330,16 +3341,17 @@ module browser threading seems wrong. (make-object separator-menu-item% file-menu))] (define close-tab-menu-item #f) (define/override (file-menu:between-close-and-quit file-menu) - (set! close-tab-menu-item - (new (get-menu-item%) - (label (string-constant close-tab)) - (demand-callback - (λ (item) - (send item enable (1 . < . (send tabs-panel get-number))))) - (parent file-menu) - (callback - (λ (x y) - (close-current-tab))))) + (unless (eq? (system-type) 'linux) + (set! close-tab-menu-item + (new (get-menu-item%) + (label (string-constant close-tab)) + (demand-callback + (λ (item) + (send item enable (1 . < . (send tabs-panel get-number))))) + (parent file-menu) + (callback + (λ (x y) + (close-current-tab)))))) (super file-menu:between-close-and-quit file-menu)) (define/override (file-menu:save-string) (string-constant save-definitions)) diff --git a/collects/framework/private/standard-menus-items.rkt b/collects/framework/private/standard-menus-items.rkt index 315ae51e1c..fa1abca2a6 100644 --- a/collects/framework/private/standard-menus-items.rkt +++ b/collects/framework/private/standard-menus-items.rkt @@ -265,7 +265,9 @@ '(λ (item control) (when (can-close?) (on-close) (show #f)) #t) #\w '(get-default-shortcut-prefix) - '(string-constant close-menu-item) + '(if (eq? (system-type) 'linux) + (string-constant close-menu-item) + (string-constant close-window-menu-item)) on-demand-do-nothing #t) (make-between 'file-menu 'close 'quit 'nothing) diff --git a/collects/framework/private/standard-menus.rkt b/collects/framework/private/standard-menus.rkt index ee2829ab60..0daadbb1cd 100644 --- a/collects/framework/private/standard-menus.rkt +++ b/collects/framework/private/standard-menus.rkt @@ -272,7 +272,11 @@ file-menu:close-callback (λ (item control) (when (can-close?) (on-close) (show #f)) #t)) (define/public (file-menu:get-close-item) file-menu:close-item) - (define/public (file-menu:close-string) (string-constant close-menu-item)) + (define/public + (file-menu:close-string) + (if (eq? (system-type) 'linux) + (string-constant close-menu-item) + (string-constant close-window-menu-item))) (define/public (file-menu:close-help-string) (string-constant close-info)) (define/public file-menu:close-on-demand (λ (menu-item) (void))) (define/public (file-menu:create-close?) #t) diff --git a/collects/scribblings/framework/standard-menus.scrbl b/collects/scribblings/framework/standard-menus.scrbl index 498ca26d45..e0f22dd621 100644 --- a/collects/scribblings/framework/standard-menus.scrbl +++ b/collects/scribblings/framework/standard-menus.scrbl @@ -118,7 +118,7 @@ @(defmethod (file-menu:close-on-demand (menu-item (is-a?/c menu-item%))) void? "The menu item's on-demand proc calls this method." "\n" "\n" "Defaults to " (racketblock (void))) -@(defmethod (file-menu:close-string) string? "The result of this method is used as the name of the " (racket menu-item%) "." "\n" "\n" "Defaults to " (racket (string-constant close-menu-item)) ".") +@(defmethod (file-menu:close-string) string? "The result of this method is used as the name of the " (racket menu-item%) "." "\n" "\n" "Defaults to " (racket (if (eq? (system-type) (quote linux)) (string-constant close-menu-item) (string-constant close-window-menu-item))) ".") @(defmethod (file-menu:close-help-string) string? "The result of this method is used as the help string" "\n" "when the " (racket menu-item%) " object is created." "\n" "\n" "Defaults to " (racket (string-constant close-info)) ".") diff --git a/collects/string-constants/private/english-string-constants.rkt b/collects/string-constants/private/english-string-constants.rkt index bb287fff8e..6441bc4086 100644 --- a/collects/string-constants/private/english-string-constants.rkt +++ b/collects/string-constants/private/english-string-constants.rkt @@ -113,9 +113,10 @@ please adhere to these guidelines: (untitled-n "Untitled ~a") (warning "Warning") (error "Error") - (close "Close") ;; as in, close an open window. must match close-menu-item + (close "Close") ;; as in, close an open window or tab. must match close-menu-item ;; in the sense that, when the &s have been stripped from ;; close-menu-item, it must be the same string as this. + (close-window "Close Window") (stop "Stop") (&stop "&Stop") ;; for use in button and menu item labels, with short cut. (are-you-sure-delete? "Are you sure you want to delete ~a?") ;; ~a is a filename or directory name @@ -674,6 +675,7 @@ please adhere to these guidelines: (close-info "Close this file") (close-menu-item "&Close") + (close-window-menu-item "&Close Window") (quit-info "Close all windows") (quit-menu-item-windows "E&xit")