ui: Add a floating-window window-contol for opening floating windows in a tiling window manager on gtk. Use this style on the help browser, inspector, and deploy windows. Please report any other windows that need this flag since I don't regularly use a tiling window manager. Tested on Ubuntu 14.04 64bit with i3 window manager. Fixes #1026.

db4
Doug Coleman 2014-07-16 02:26:52 -07:00
parent 80be72b6e1
commit 57cdc841c3
6 changed files with 36 additions and 10 deletions

View File

@ -361,6 +361,7 @@ CONSTANT: window-controls>decor-flags
{ small-title-bar $ GDK_DECOR_TITLE } { small-title-bar $ GDK_DECOR_TITLE }
{ normal-title-bar $ GDK_DECOR_TITLE } { normal-title-bar $ GDK_DECOR_TITLE }
{ textured-background 0 } { textured-background 0 }
{ floating-window 0 }
} }
CONSTANT: window-controls>func-flags CONSTANT: window-controls>func-flags
@ -372,13 +373,19 @@ CONSTANT: window-controls>func-flags
{ small-title-bar 0 } { small-title-bar 0 }
{ normal-title-bar 0 } { normal-title-bar 0 }
{ textured-background 0 } { textured-background 0 }
{ floating-window 0 }
} }
: set-window-hint ( win controls -- )
{
{ [ floating-window over member-eq? ] [ drop GDK_WINDOW_TYPE_HINT_DIALOG ] }
{ [ small-title-bar over member-eq? ] [ drop GDK_WINDOW_TYPE_HINT_UTILITY ] }
[ drop GDK_WINDOW_TYPE_HINT_NORMAL ]
} cond gtk_window_set_type_hint ;
: configure-window-controls ( win controls -- ) : configure-window-controls ( win controls -- )
[ [
small-title-bar swap member-eq? set-window-hint
GDK_WINDOW_TYPE_HINT_UTILITY GDK_WINDOW_TYPE_HINT_NORMAL ?
gtk_window_set_type_hint
] [ ] [
[ gtk_widget_get_window ] dip [ gtk_widget_get_window ] dip
window-controls>decor-flags symbols>flags window-controls>decor-flags symbols>flags

View File

@ -15,7 +15,8 @@ SYMBOLS:
resize-handles resize-handles
small-title-bar small-title-bar
normal-title-bar normal-title-bar
textured-background ; textured-background
floating-window ;
CONSTANT: default-world-pixel-format-attributes CONSTANT: default-world-pixel-format-attributes
{ {

View File

@ -8,7 +8,7 @@ ui.gadgets.borders ui.gadgets.buttons ui.gadgets.editors
ui.gadgets.glass ui.gadgets.labels ui.gadgets.panes ui.gadgets.glass ui.gadgets.labels ui.gadgets.panes
ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.tracks ui.gadgets.scrollers ui.gadgets.status-bar ui.gadgets.tracks
ui.gadgets.viewports ui.gestures ui.tools.browser.history ui.gadgets.viewports ui.gestures ui.tools.browser.history
ui.tools.browser.popups ui.tools.common vocabs ; ui.tools.browser.popups ui.tools.common vocabs ui.gadgets.worlds ;
IN: ui.tools.browser IN: ui.tools.browser
TUPLE: browser-gadget < tool history scroller search-field popup ; TUPLE: browser-gadget < tool history scroller search-field popup ;
@ -89,7 +89,11 @@ M: browser-gadget definitions-changed ( set browser -- )
M: browser-gadget focusable-child* search-field>> ; M: browser-gadget focusable-child* search-field>> ;
: (browser-window) ( topic -- ) : (browser-window) ( topic -- )
<browser-gadget> "Browser" open-status-window ; <browser-gadget>
<world-attributes>
"Browser" >>title
{ floating-window } >>window-controls
open-status-window ;
: browser-window ( -- ) : browser-window ( -- )
"help.home" (browser-window) ; "help.home" (browser-window) ;

View File

@ -5,7 +5,8 @@ tools.deploy.config.editor tools.deploy vocabs namespaces
models.mapping sequences system accessors fry ui.gadgets ui.render models.mapping sequences system accessors fry ui.gadgets ui.render
ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels ui.gadgets.buttons ui.gadgets.packs ui.gadgets.labels
ui.gadgets.editors ui.gadgets.borders ui.gestures ui.commands assocs ui.gadgets.editors ui.gadgets.borders ui.gestures ui.commands assocs
ui.gadgets.tracks ui ui.tools.listener ui.tools.browser ; ui.gadgets.tracks ui ui.tools.listener ui.tools.browser
ui.gadgets.worlds ;
IN: ui.tools.deploy IN: ui.tools.deploy
TUPLE: deploy-gadget < pack vocab settings ; TUPLE: deploy-gadget < pack vocab settings ;
@ -111,5 +112,9 @@ deploy-gadget "toolbar" f {
: deploy-tool ( vocab -- ) : deploy-tool ( vocab -- )
vocab-name vocab-name
[ <deploy-gadget> { 10 10 } <border> ] [ <deploy-gadget> { 10 10 } <border> ]
[ "Deploying “" "”" surround ] bi [
<world-attributes>
swap "Deploying “" "”" surround >>title
{ floating-window } >>window-controls
] bi
open-window ; open-window ;

View File

@ -6,7 +6,7 @@ classes io io.styles arrays hashtables math.order sorting refs fonts
ui.tools.browser ui.commands ui.operations ui.gadgets ui.gadgets.panes ui.tools.browser ui.commands ui.operations ui.gadgets ui.gadgets.panes
ui.gadgets.scrollers ui.gadgets.slots ui.gadgets.tracks ui.gestures ui.gadgets.scrollers ui.gadgets.slots ui.gadgets.tracks ui.gestures
ui.gadgets.buttons ui.gadgets.tables ui.gadgets.status-bar ui.gadgets.buttons ui.gadgets.tables ui.gadgets.status-bar
ui.gadgets.labeled ui.tools.common ui combinators ; ui.gadgets.labeled ui.tools.common ui combinators ui.gadgets.worlds ;
IN: ui.tools.inspector IN: ui.tools.inspector
TUPLE: inspector-gadget < tool table ; TUPLE: inspector-gadget < tool table ;
@ -101,7 +101,12 @@ M: inspector-gadget focusable-child*
\ com-push H{ { +listener+ t } } define-command \ com-push H{ { +listener+ t } } define-command
: slot-editor-window ( close-hook update-hook assoc key key-string -- ) : slot-editor-window ( close-hook update-hook assoc key key-string -- )
[ <value-ref> <slot-editor> ] [ "Slot editor: " prepend ] bi* [ <value-ref> <slot-editor> ]
[
<world-attributes>
swap "Slot editor: " prepend >>title
{ floating-window } >>window-controls
] bi*
open-status-window ; open-status-window ;
: com-edit-slot ( inspector -- ) : com-edit-slot ( inspector -- )

View File

@ -333,6 +333,9 @@ HELP: normal-title-bar
HELP: textured-background HELP: textured-background
{ $description "Asks for a window to have a background that blends seamlessly with the window frame. Factor will leave the window background transparent and pass mouse button gestures not handled directly by a gadget through to the window system so that the window can be dragged from anywhere on its background." } ; { $description "Asks for a window to have a background that blends seamlessly with the window frame. Factor will leave the window background transparent and pass mouse button gestures not handled directly by a gadget through to the window system so that the window can be dragged from anywhere on its background." } ;
HELP: floating-window
{ $description "Provides a hint to the window manager to create a floating, dialog-style window. Currently, this is only implemented for the GTK backend." } ;
HELP: MAIN-WINDOW: HELP: MAIN-WINDOW:
{ $syntax "MAIN-WINDOW: window-word { attributes } { $syntax "MAIN-WINDOW: window-word { attributes }
attribute-code ;" } attribute-code ;" }
@ -357,5 +360,6 @@ ARTICLE: "ui.gadgets.worlds-window-controls" "Window controls"
small-title-bar small-title-bar
normal-title-bar normal-title-bar
textured-background textured-background
floating-window
} }
"Provide a sequence of these values in the " { $snippet "window-controls" } " slot of the " { $link world-attributes } " tuple you pass to " { $link open-window } "." ; "Provide a sequence of these values in the " { $snippet "window-controls" } " slot of the " { $link world-attributes } " tuple you pass to " { $link open-window } "." ;