Merge lp:~noskcaj/ubuntu/vivid/xfwm4/4.11.3 into lp:ubuntu/vivid/xfwm4

Proposed by Jackson Doak on 2015-02-14
Status: Merged
Merged at revision: 75
Proposed branch: lp:~noskcaj/ubuntu/vivid/xfwm4/4.11.3
Merge into: lp:ubuntu/vivid/xfwm4
Diff against target: 84702 lines (+48620/-23755)
460 files modified
.pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch/src/client.c (+0/-3922)
.pc/02-remove-unused-maximize-button.patch/src/client.c (+0/-3926)
.pc/applied-patches (+0/-2)
ChangeLog (+1751/-0)
Makefile.in (+1/-1)
NEWS (+44/-0)
aclocal.m4 (+455/-445)
config.guess (+8/-156)
config.sub (+16/-11)
configure (+81/-28)
configure.ac (+14/-10)
debian/changelog (+12/-0)
debian/patches/0001-fix-fullscreen-qt4-behavior-bug-8563.patch (+0/-48)
debian/patches/02-remove-unused-maximize-button.patch (+0/-20)
debian/patches/series (+0/-2)
defaults/defaults (+3/-0)
po/ast.po (+15/-13)
po/bg.po (+36/-32)
po/cs.po (+36/-32)
po/da.po (+77/-65)
po/de.po (+73/-69)
po/en_AU.po (+60/-56)
po/es.po (+24/-24)
po/fi.po (+66/-56)
po/fr.po (+74/-69)
po/he.po (+355/-1216)
po/hr.po (+40/-35)
po/hu.po (+66/-55)
po/id.po (+57/-52)
po/it.po (+35/-31)
po/ja.po (+33/-29)
po/kk.po (+34/-30)
po/ko.po (+34/-30)
po/ms.po (+34/-30)
po/nl.po (+35/-31)
po/pl.po (+35/-30)
po/pt_BR.po (+50/-44)
po/ru.po (+45/-40)
po/sr.po (+38/-34)
po/th.po (+36/-32)
po/tr.po (+58/-53)
po/uk.po (+33/-29)
po/zh_CN.po (+14/-14)
settings-dialogs/tweaks-settings.c (+25/-27)
settings-dialogs/xfwm4-tweaks-dialog.glade (+32/-17)
settings-dialogs/xfwm4-tweaks-dialog_ui.h (+230/-222)
src/client.c (+321/-172)
src/client.h (+42/-11)
src/compositor.c (+269/-73)
src/compositor.h (+6/-1)
src/cycle.c (+132/-115)
src/display.c (+24/-12)
src/display.h (+5/-2)
src/events.c (+106/-163)
src/events.h (+1/-1)
src/focus.c (+4/-2)
src/frame.c (+118/-15)
src/frame.h (+8/-0)
src/hints.c (+12/-6)
src/hints.h (+8/-4)
src/icons.c (+151/-72)
src/icons.h (+9/-5)
src/main.c (+67/-1)
src/moveresize.c (+436/-393)
src/moveresize.h (+5/-0)
src/mypixmap.c (+3/-3)
src/netwm.c (+10/-5)
src/netwm.h (+1/-1)
src/placement.c (+100/-94)
src/placement.h (+1/-1)
src/screen.c (+2/-2)
src/session.c (+2/-1)
src/settings.c (+107/-24)
src/settings.h (+8/-2)
src/startup_notification.c (+2/-1)
src/tabwin.c (+489/-343)
src/tabwin.h (+12/-6)
src/wireframe.c (+208/-53)
src/wireframe.h (+25/-5)
src/workspaces.c (+56/-0)
src/xsync.c (+131/-94)
src/xsync.h (+5/-9)
themes/Makefile.am (+2/-0)
themes/Makefile.in (+2/-0)
themes/daloa/Makefile.am (+1/-1)
themes/daloa/Makefile.in (+1/-1)
themes/default-hdpi/Makefile.am (+211/-0)
themes/default-hdpi/Makefile.in (+779/-0)
themes/default-hdpi/README (+4/-0)
themes/default-hdpi/bottom-active.svg (+123/-0)
themes/default-hdpi/bottom-active.xpm (+12/-0)
themes/default-hdpi/bottom-inactive.svg (+123/-0)
themes/default-hdpi/bottom-inactive.xpm (+12/-0)
themes/default-hdpi/bottom-left-active.svg (+122/-0)
themes/default-hdpi/bottom-left-active.xpm (+30/-0)
themes/default-hdpi/bottom-left-inactive.svg (+122/-0)
themes/default-hdpi/bottom-left-inactive.xpm (+30/-0)
themes/default-hdpi/bottom-right-active.svg (+122/-0)
themes/default-hdpi/bottom-right-active.xpm (+30/-0)
themes/default-hdpi/bottom-right-inactive.svg (+122/-0)
themes/default-hdpi/bottom-right-inactive.xpm (+30/-0)
themes/default-hdpi/close-active.svg (+223/-0)
themes/default-hdpi/close-active.xpm (+48/-0)
themes/default-hdpi/close-inactive.svg (+181/-0)
themes/default-hdpi/close-inactive.xpm (+48/-0)
themes/default-hdpi/close-prelight.svg (+241/-0)
themes/default-hdpi/close-prelight.xpm (+48/-0)
themes/default-hdpi/close-pressed.svg (+241/-0)
themes/default-hdpi/close-pressed.xpm (+48/-0)
themes/default-hdpi/hide-active.svg (+217/-0)
themes/default-hdpi/hide-active.xpm (+48/-0)
themes/default-hdpi/hide-inactive.svg (+181/-0)
themes/default-hdpi/hide-inactive.xpm (+48/-0)
themes/default-hdpi/hide-prelight.svg (+235/-0)
themes/default-hdpi/hide-prelight.xpm (+48/-0)
themes/default-hdpi/hide-pressed.svg (+235/-0)
themes/default-hdpi/hide-pressed.xpm (+48/-0)
themes/default-hdpi/left-active.svg (+121/-0)
themes/default-hdpi/left-active.xpm (+38/-0)
themes/default-hdpi/left-inactive.svg (+121/-0)
themes/default-hdpi/left-inactive.xpm (+38/-0)
themes/default-hdpi/maximize-active.svg (+211/-0)
themes/default-hdpi/maximize-active.xpm (+48/-0)
themes/default-hdpi/maximize-inactive.svg (+178/-0)
themes/default-hdpi/maximize-inactive.xpm (+48/-0)
themes/default-hdpi/maximize-prelight.svg (+229/-0)
themes/default-hdpi/maximize-prelight.xpm (+48/-0)
themes/default-hdpi/maximize-pressed.svg (+229/-0)
themes/default-hdpi/maximize-pressed.xpm (+48/-0)
themes/default-hdpi/maximize-toggled-active.svg (+215/-0)
themes/default-hdpi/maximize-toggled-active.xpm (+48/-0)
themes/default-hdpi/maximize-toggled-inactive.svg (+182/-0)
themes/default-hdpi/maximize-toggled-inactive.xpm (+48/-0)
themes/default-hdpi/maximize-toggled-prelight.svg (+233/-0)
themes/default-hdpi/maximize-toggled-prelight.xpm (+48/-0)
themes/default-hdpi/maximize-toggled-pressed.svg (+233/-0)
themes/default-hdpi/maximize-toggled-pressed.xpm (+48/-0)
themes/default-hdpi/menu-active.svg (+164/-0)
themes/default-hdpi/menu-active.xpm (+48/-0)
themes/default-hdpi/menu-inactive.svg (+164/-0)
themes/default-hdpi/menu-inactive.xpm (+48/-0)
themes/default-hdpi/menu-prelight.svg (+164/-0)
themes/default-hdpi/menu-prelight.xpm (+48/-0)
themes/default-hdpi/menu-pressed.svg (+164/-0)
themes/default-hdpi/menu-pressed.xpm (+48/-0)
themes/default-hdpi/right-active.svg (+121/-0)
themes/default-hdpi/right-active.xpm (+38/-0)
themes/default-hdpi/right-inactive.svg (+121/-0)
themes/default-hdpi/right-inactive.xpm (+38/-0)
themes/default-hdpi/shade-active.svg (+211/-0)
themes/default-hdpi/shade-active.xpm (+48/-0)
themes/default-hdpi/shade-inactive.svg (+178/-0)
themes/default-hdpi/shade-inactive.xpm (+48/-0)
themes/default-hdpi/shade-prelight.svg (+229/-0)
themes/default-hdpi/shade-prelight.xpm (+48/-0)
themes/default-hdpi/shade-pressed.svg (+229/-0)
themes/default-hdpi/shade-pressed.xpm (+48/-0)
themes/default-hdpi/shade-toggled-active.svg (+211/-0)
themes/default-hdpi/shade-toggled-active.xpm (+48/-0)
themes/default-hdpi/shade-toggled-inactive.svg (+178/-0)
themes/default-hdpi/shade-toggled-inactive.xpm (+48/-0)
themes/default-hdpi/shade-toggled-prelight.svg (+229/-0)
themes/default-hdpi/shade-toggled-prelight.xpm (+48/-0)
themes/default-hdpi/shade-toggled-pressed.svg (+229/-0)
themes/default-hdpi/shade-toggled-pressed.xpm (+48/-0)
themes/default-hdpi/stick-active.svg (+211/-0)
themes/default-hdpi/stick-active.xpm (+48/-0)
themes/default-hdpi/stick-inactive.svg (+178/-0)
themes/default-hdpi/stick-inactive.xpm (+48/-0)
themes/default-hdpi/stick-prelight.svg (+229/-0)
themes/default-hdpi/stick-prelight.xpm (+48/-0)
themes/default-hdpi/stick-pressed.svg (+229/-0)
themes/default-hdpi/stick-pressed.xpm (+48/-0)
themes/default-hdpi/stick-toggled-active.svg (+220/-0)
themes/default-hdpi/stick-toggled-active.xpm (+48/-0)
themes/default-hdpi/stick-toggled-inactive.svg (+187/-0)
themes/default-hdpi/stick-toggled-inactive.xpm (+48/-0)
themes/default-hdpi/stick-toggled-prelight.svg (+238/-0)
themes/default-hdpi/stick-toggled-prelight.xpm (+48/-0)
themes/default-hdpi/stick-toggled-pressed.svg (+238/-0)
themes/default-hdpi/stick-toggled-pressed.xpm (+48/-0)
themes/default-hdpi/themerc (+19/-0)
themes/default-hdpi/title-1-active.svg (+164/-0)
themes/default-hdpi/title-1-active.xpm (+48/-0)
themes/default-hdpi/title-1-inactive.svg (+164/-0)
themes/default-hdpi/title-1-inactive.xpm (+48/-0)
themes/default-hdpi/title-2-active.svg (+164/-0)
themes/default-hdpi/title-2-active.xpm (+48/-0)
themes/default-hdpi/title-2-inactive.svg (+164/-0)
themes/default-hdpi/title-2-inactive.xpm (+48/-0)
themes/default-hdpi/title-3-active.svg (+164/-0)
themes/default-hdpi/title-3-active.xpm (+48/-0)
themes/default-hdpi/title-3-inactive.svg (+164/-0)
themes/default-hdpi/title-3-inactive.xpm (+48/-0)
themes/default-hdpi/title-4-active.svg (+193/-0)
themes/default-hdpi/title-4-active.xpm (+48/-0)
themes/default-hdpi/title-4-inactive.svg (+164/-0)
themes/default-hdpi/title-4-inactive.xpm (+48/-0)
themes/default-hdpi/title-5-active.svg (+193/-0)
themes/default-hdpi/title-5-active.xpm (+48/-0)
themes/default-hdpi/title-5-inactive.svg (+164/-0)
themes/default-hdpi/title-5-inactive.xpm (+48/-0)
themes/default-hdpi/top-left-active.svg (+161/-0)
themes/default-hdpi/top-left-active.xpm (+48/-0)
themes/default-hdpi/top-left-inactive.svg (+161/-0)
themes/default-hdpi/top-left-inactive.xpm (+48/-0)
themes/default-hdpi/top-right-active.svg (+193/-0)
themes/default-hdpi/top-right-active.xpm (+48/-0)
themes/default-hdpi/top-right-inactive.svg (+161/-0)
themes/default-hdpi/top-right-inactive.xpm (+48/-0)
themes/default-xhdpi/Makefile.am (+211/-0)
themes/default-xhdpi/Makefile.in (+779/-0)
themes/default-xhdpi/README (+4/-0)
themes/default-xhdpi/bottom-active.svg (+105/-0)
themes/default-xhdpi/bottom-active.xpm (+18/-0)
themes/default-xhdpi/bottom-inactive.svg (+105/-0)
themes/default-xhdpi/bottom-inactive.xpm (+18/-0)
themes/default-xhdpi/bottom-left-active.svg (+104/-0)
themes/default-xhdpi/bottom-left-active.xpm (+38/-0)
themes/default-xhdpi/bottom-left-inactive.svg (+104/-0)
themes/default-xhdpi/bottom-left-inactive.xpm (+38/-0)
themes/default-xhdpi/bottom-right-active.svg (+104/-0)
themes/default-xhdpi/bottom-right-active.xpm (+38/-0)
themes/default-xhdpi/bottom-right-inactive.svg (+104/-0)
themes/default-xhdpi/bottom-right-inactive.xpm (+38/-0)
themes/default-xhdpi/close-active.svg (+223/-0)
themes/default-xhdpi/close-active.xpm (+62/-0)
themes/default-xhdpi/close-inactive.svg (+181/-0)
themes/default-xhdpi/close-inactive.xpm (+62/-0)
themes/default-xhdpi/close-prelight.svg (+241/-0)
themes/default-xhdpi/close-prelight.xpm (+62/-0)
themes/default-xhdpi/close-pressed.svg (+241/-0)
themes/default-xhdpi/close-pressed.xpm (+62/-0)
themes/default-xhdpi/hide-active.svg (+217/-0)
themes/default-xhdpi/hide-active.xpm (+62/-0)
themes/default-xhdpi/hide-inactive.svg (+181/-0)
themes/default-xhdpi/hide-inactive.xpm (+62/-0)
themes/default-xhdpi/hide-prelight.svg (+235/-0)
themes/default-xhdpi/hide-prelight.xpm (+62/-0)
themes/default-xhdpi/hide-pressed.svg (+235/-0)
themes/default-xhdpi/hide-pressed.xpm (+62/-0)
themes/default-xhdpi/left-active.svg (+103/-0)
themes/default-xhdpi/left-active.xpm (+54/-0)
themes/default-xhdpi/left-inactive.svg (+103/-0)
themes/default-xhdpi/left-inactive.xpm (+54/-0)
themes/default-xhdpi/maximize-active.svg (+211/-0)
themes/default-xhdpi/maximize-active.xpm (+62/-0)
themes/default-xhdpi/maximize-inactive.svg (+178/-0)
themes/default-xhdpi/maximize-inactive.xpm (+62/-0)
themes/default-xhdpi/maximize-prelight.svg (+229/-0)
themes/default-xhdpi/maximize-prelight.xpm (+62/-0)
themes/default-xhdpi/maximize-pressed.svg (+229/-0)
themes/default-xhdpi/maximize-pressed.xpm (+62/-0)
themes/default-xhdpi/maximize-toggled-active.svg (+215/-0)
themes/default-xhdpi/maximize-toggled-active.xpm (+62/-0)
themes/default-xhdpi/maximize-toggled-inactive.svg (+182/-0)
themes/default-xhdpi/maximize-toggled-inactive.xpm (+62/-0)
themes/default-xhdpi/maximize-toggled-prelight.svg (+233/-0)
themes/default-xhdpi/maximize-toggled-prelight.xpm (+62/-0)
themes/default-xhdpi/maximize-toggled-pressed.svg (+233/-0)
themes/default-xhdpi/maximize-toggled-pressed.xpm (+62/-0)
themes/default-xhdpi/menu-active.svg (+164/-0)
themes/default-xhdpi/menu-active.xpm (+62/-0)
themes/default-xhdpi/menu-inactive.svg (+164/-0)
themes/default-xhdpi/menu-inactive.xpm (+62/-0)
themes/default-xhdpi/menu-prelight.svg (+164/-0)
themes/default-xhdpi/menu-prelight.xpm (+62/-0)
themes/default-xhdpi/menu-pressed.svg (+164/-0)
themes/default-xhdpi/menu-pressed.xpm (+62/-0)
themes/default-xhdpi/right-active.svg (+103/-0)
themes/default-xhdpi/right-active.xpm (+54/-0)
themes/default-xhdpi/right-inactive.svg (+103/-0)
themes/default-xhdpi/right-inactive.xpm (+54/-0)
themes/default-xhdpi/shade-active.svg (+211/-0)
themes/default-xhdpi/shade-active.xpm (+62/-0)
themes/default-xhdpi/shade-inactive.svg (+178/-0)
themes/default-xhdpi/shade-inactive.xpm (+62/-0)
themes/default-xhdpi/shade-prelight.svg (+229/-0)
themes/default-xhdpi/shade-prelight.xpm (+62/-0)
themes/default-xhdpi/shade-pressed.svg (+229/-0)
themes/default-xhdpi/shade-pressed.xpm (+62/-0)
themes/default-xhdpi/shade-toggled-active.svg (+211/-0)
themes/default-xhdpi/shade-toggled-active.xpm (+62/-0)
themes/default-xhdpi/shade-toggled-inactive.svg (+178/-0)
themes/default-xhdpi/shade-toggled-inactive.xpm (+62/-0)
themes/default-xhdpi/shade-toggled-prelight.svg (+229/-0)
themes/default-xhdpi/shade-toggled-prelight.xpm (+62/-0)
themes/default-xhdpi/shade-toggled-pressed.svg (+229/-0)
themes/default-xhdpi/shade-toggled-pressed.xpm (+62/-0)
themes/default-xhdpi/stick-active.svg (+211/-0)
themes/default-xhdpi/stick-active.xpm (+62/-0)
themes/default-xhdpi/stick-inactive.svg (+178/-0)
themes/default-xhdpi/stick-inactive.xpm (+62/-0)
themes/default-xhdpi/stick-prelight.svg (+229/-0)
themes/default-xhdpi/stick-prelight.xpm (+62/-0)
themes/default-xhdpi/stick-pressed.svg (+229/-0)
themes/default-xhdpi/stick-pressed.xpm (+62/-0)
themes/default-xhdpi/stick-toggled-active.svg (+220/-0)
themes/default-xhdpi/stick-toggled-active.xpm (+62/-0)
themes/default-xhdpi/stick-toggled-inactive.svg (+187/-0)
themes/default-xhdpi/stick-toggled-inactive.xpm (+62/-0)
themes/default-xhdpi/stick-toggled-prelight.svg (+238/-0)
themes/default-xhdpi/stick-toggled-prelight.xpm (+62/-0)
themes/default-xhdpi/stick-toggled-pressed.svg (+238/-0)
themes/default-xhdpi/stick-toggled-pressed.xpm (+62/-0)
themes/default-xhdpi/themerc (+19/-0)
themes/default-xhdpi/title-1-active.svg (+164/-0)
themes/default-xhdpi/title-1-active.xpm (+63/-0)
themes/default-xhdpi/title-1-inactive.svg (+164/-0)
themes/default-xhdpi/title-1-inactive.xpm (+63/-0)
themes/default-xhdpi/title-2-active.svg (+164/-0)
themes/default-xhdpi/title-2-active.xpm (+63/-0)
themes/default-xhdpi/title-2-inactive.svg (+164/-0)
themes/default-xhdpi/title-2-inactive.xpm (+63/-0)
themes/default-xhdpi/title-3-active.svg (+164/-0)
themes/default-xhdpi/title-3-active.xpm (+63/-0)
themes/default-xhdpi/title-3-inactive.svg (+164/-0)
themes/default-xhdpi/title-3-inactive.xpm (+63/-0)
themes/default-xhdpi/title-4-active.svg (+193/-0)
themes/default-xhdpi/title-4-active.xpm (+63/-0)
themes/default-xhdpi/title-4-inactive.svg (+164/-0)
themes/default-xhdpi/title-4-inactive.xpm (+63/-0)
themes/default-xhdpi/title-5-active.svg (+193/-0)
themes/default-xhdpi/title-5-active.xpm (+63/-0)
themes/default-xhdpi/title-5-inactive.svg (+164/-0)
themes/default-xhdpi/title-5-inactive.xpm (+63/-0)
themes/default-xhdpi/top-left-active.svg (+161/-0)
themes/default-xhdpi/top-left-active.xpm (+63/-0)
themes/default-xhdpi/top-left-inactive.svg (+161/-0)
themes/default-xhdpi/top-left-inactive.xpm (+63/-0)
themes/default-xhdpi/top-right-active.svg (+193/-0)
themes/default-xhdpi/top-right-active.xpm (+63/-0)
themes/default-xhdpi/top-right-inactive.svg (+161/-0)
themes/default-xhdpi/top-right-inactive.xpm (+63/-0)
themes/default/Makefile.am (+1/-1)
themes/default/Makefile.in (+1/-1)
themes/default/README (+3/-2)
themes/default/bottom-active.svg (+80/-43)
themes/default/bottom-active.xpm (+6/-7)
themes/default/bottom-inactive.svg (+80/-43)
themes/default/bottom-inactive.xpm (+6/-7)
themes/default/bottom-left-active.svg (+78/-41)
themes/default/bottom-left-active.xpm (+18/-18)
themes/default/bottom-left-inactive.svg (+78/-41)
themes/default/bottom-left-inactive.xpm (+18/-18)
themes/default/bottom-right-active.svg (+78/-41)
themes/default/bottom-right-active.xpm (+18/-18)
themes/default/bottom-right-inactive.svg (+78/-41)
themes/default/bottom-right-inactive.xpm (+18/-18)
themes/default/close-active.svg (+195/-193)
themes/default/close-active.xpm (+32/-25)
themes/default/close-inactive.svg (+155/-182)
themes/default/close-inactive.xpm (+32/-25)
themes/default/close-prelight.svg (+215/-209)
themes/default/close-prelight.xpm (+32/-25)
themes/default/close-pressed.svg (+215/-209)
themes/default/close-pressed.xpm (+33/-26)
themes/default/hide-active.svg (+191/-189)
themes/default/hide-active.xpm (+32/-25)
themes/default/hide-inactive.svg (+154/-181)
themes/default/hide-inactive.xpm (+32/-25)
themes/default/hide-prelight.svg (+209/-203)
themes/default/hide-prelight.xpm (+32/-25)
themes/default/hide-pressed.svg (+209/-203)
themes/default/hide-pressed.xpm (+33/-26)
themes/default/left-active.svg (+78/-41)
themes/default/left-active.xpm (+28/-28)
themes/default/left-inactive.svg (+78/-41)
themes/default/left-inactive.xpm (+28/-28)
themes/default/maximize-active.svg (+185/-183)
themes/default/maximize-active.xpm (+32/-25)
themes/default/maximize-inactive.svg (+152/-179)
themes/default/maximize-inactive.xpm (+32/-25)
themes/default/maximize-prelight.svg (+203/-197)
themes/default/maximize-prelight.xpm (+32/-25)
themes/default/maximize-pressed.svg (+203/-197)
themes/default/maximize-pressed.xpm (+33/-26)
themes/default/maximize-toggled-active.svg (+189/-187)
themes/default/maximize-toggled-active.xpm (+32/-25)
themes/default/maximize-toggled-inactive.svg (+156/-183)
themes/default/maximize-toggled-inactive.xpm (+32/-25)
themes/default/maximize-toggled-prelight.svg (+207/-201)
themes/default/maximize-toggled-prelight.xpm (+32/-25)
themes/default/maximize-toggled-pressed.svg (+207/-201)
themes/default/maximize-toggled-pressed.xpm (+33/-26)
themes/default/menu-active.svg (+139/-166)
themes/default/menu-active.xpm (+32/-26)
themes/default/menu-inactive.svg (+139/-166)
themes/default/menu-inactive.xpm (+32/-26)
themes/default/menu-prelight.svg (+139/-166)
themes/default/menu-prelight.xpm (+32/-26)
themes/default/menu-pressed.svg (+139/-166)
themes/default/menu-pressed.xpm (+33/-27)
themes/default/right-active.svg (+78/-41)
themes/default/right-active.xpm (+28/-28)
themes/default/right-inactive.svg (+78/-41)
themes/default/right-inactive.xpm (+28/-28)
themes/default/shade-active.svg (+185/-183)
themes/default/shade-active.xpm (+32/-25)
themes/default/shade-inactive.svg (+152/-179)
themes/default/shade-inactive.xpm (+32/-25)
themes/default/shade-prelight.svg (+203/-197)
themes/default/shade-prelight.xpm (+32/-25)
themes/default/shade-pressed.svg (+203/-197)
themes/default/shade-pressed.xpm (+33/-26)
themes/default/shade-toggled-active.svg (+185/-183)
themes/default/shade-toggled-active.xpm (+32/-25)
themes/default/shade-toggled-inactive.svg (+152/-179)
themes/default/shade-toggled-inactive.xpm (+32/-25)
themes/default/shade-toggled-prelight.svg (+203/-197)
themes/default/shade-toggled-prelight.xpm (+32/-25)
themes/default/shade-toggled-pressed.svg (+203/-197)
themes/default/shade-toggled-pressed.xpm (+33/-26)
themes/default/stick-active.svg (+185/-183)
themes/default/stick-active.xpm (+32/-25)
themes/default/stick-inactive.svg (+152/-179)
themes/default/stick-inactive.xpm (+32/-25)
themes/default/stick-prelight.svg (+203/-197)
themes/default/stick-prelight.xpm (+32/-25)
themes/default/stick-pressed.svg (+203/-197)
themes/default/stick-pressed.xpm (+33/-26)
themes/default/stick-toggled-active.svg (+194/-188)
themes/default/stick-toggled-active.xpm (+32/-25)
themes/default/stick-toggled-inactive.svg (+161/-193)
themes/default/stick-toggled-inactive.xpm (+32/-25)
themes/default/stick-toggled-prelight.svg (+212/-202)
themes/default/stick-toggled-prelight.xpm (+32/-25)
themes/default/stick-toggled-pressed.svg (+212/-202)
themes/default/stick-toggled-pressed.xpm (+33/-26)
themes/default/themerc (+16/-12)
themes/default/title-1-active.svg (+138/-165)
themes/default/title-1-active.xpm (+32/-25)
themes/default/title-1-inactive.svg (+138/-165)
themes/default/title-1-inactive.xpm (+32/-25)
themes/default/title-2-active.svg (+138/-165)
themes/default/title-2-active.xpm (+32/-25)
themes/default/title-2-inactive.svg (+138/-165)
themes/default/title-2-inactive.xpm (+32/-25)
themes/default/title-3-active.svg (+138/-165)
themes/default/title-3-active.xpm (+32/-25)
themes/default/title-3-inactive.svg (+138/-165)
themes/default/title-3-inactive.xpm (+32/-25)
themes/default/title-4-active.svg (+167/-165)
themes/default/title-4-active.xpm (+32/-25)
themes/default/title-4-inactive.svg (+138/-165)
themes/default/title-4-inactive.xpm (+32/-25)
themes/default/title-5-active.svg (+167/-165)
themes/default/title-5-active.xpm (+32/-25)
themes/default/title-5-inactive.svg (+138/-165)
themes/default/title-5-inactive.xpm (+32/-25)
themes/default/top-left-active.svg (+135/-159)
themes/default/top-left-active.xpm (+32/-25)
themes/default/top-left-inactive.svg (+135/-159)
themes/default/top-left-inactive.xpm (+32/-25)
themes/default/top-right-active.svg (+167/-159)
themes/default/top-right-active.xpm (+32/-25)
themes/default/top-right-inactive.svg (+135/-159)
themes/default/top-right-inactive.xpm (+32/-25)
themes/kokodi/Makefile.am (+1/-1)
themes/kokodi/Makefile.in (+1/-1)
To merge this branch: bzr merge lp:~noskcaj/ubuntu/vivid/xfwm4/4.11.3
Reviewer Review Type Date Requested Status
Sean Davis (community) xubuntu technical lead Approve on 2015-02-15
Ubuntu branches 2015-02-14 Pending
Review via email: mp+249761@code.launchpad.net

Description of the Change

New upstream release. Many fixes

To post a comment you must log in.
Sean Davis (bluesabre) wrote :

Good job, uploaded to vivid and merged the branch.

review: Approve (xubuntu technical lead)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory '.pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch'
2=== removed directory '.pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch/src'
3=== removed file '.pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch/src/client.c'
4--- .pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch/src/client.c 2014-07-25 21:25:31 +0000
5+++ .pc/0001-fix-fullscreen-qt4-behavior-bug-8563.patch/src/client.c 1970-01-01 00:00:00 +0000
6@@ -1,3922 +0,0 @@
7-/* $Id$
8-
9- This program is free software; you can redistribute it and/or modify
10- it under the terms of the GNU General Public License as published by
11- the Free Software Foundation; either version 2, or (at your option)
12- any later version.
13-
14- This program is distributed in the hope that it will be useful,
15- but WITHOUT ANY WARRANTY; without even the implied warranty of
16- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17- GNU General Public License for more details.
18-
19- You should have received a copy of the GNU General Public License
20- along with this program; if not, write to the Free Software
21- Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston,
22- MA 02110-1301, USA.
23-
24-
25- oroborus - (c) 2001 Ken Lynch
26- xfwm4 - (c) 2002-2011 Olivier Fourdan
27-
28- */
29-
30-#ifdef HAVE_CONFIG_H
31-#include "config.h"
32-#endif
33-
34-#include <sys/types.h>
35-#include <signal.h>
36-#include <unistd.h>
37-#include <errno.h>
38-
39-#include <X11/X.h>
40-#include <X11/Xlib.h>
41-#include <X11/Xutil.h>
42-#include <X11/Xatom.h>
43-#include <X11/extensions/shape.h>
44-
45-#include <glib.h>
46-#include <gdk/gdk.h>
47-#include <gdk/gdkx.h>
48-#include <gtk/gtk.h>
49-#include <libxfce4util/libxfce4util.h>
50-
51-#include "client.h"
52-#include "compositor.h"
53-#include "focus.h"
54-#include "frame.h"
55-#include "hints.h"
56-#include "icons.h"
57-#include "misc.h"
58-#include "moveresize.h"
59-#include "mypixmap.h"
60-#include "mywindow.h"
61-#include "netwm.h"
62-#include "placement.h"
63-#include "screen.h"
64-#include "session.h"
65-#include "settings.h"
66-#include "stacking.h"
67-#include "startup_notification.h"
68-#include "transients.h"
69-#include "workspaces.h"
70-#include "xsync.h"
71-#include "event_filter.h"
72-
73-/* Event mask definition */
74-
75-#define POINTER_EVENT_MASK \
76- ButtonPressMask|\
77- ButtonReleaseMask
78-
79-#define FRAME_EVENT_MASK \
80- SubstructureNotifyMask|\
81- SubstructureRedirectMask|\
82- PointerMotionMask|\
83- ButtonMotionMask|\
84- FocusChangeMask|\
85- EnterWindowMask|\
86- PropertyChangeMask
87-
88-#define CLIENT_EVENT_MASK \
89- StructureNotifyMask|\
90- FocusChangeMask|\
91- PropertyChangeMask
92-
93-#define BUTTON_EVENT_MASK \
94- EnterWindowMask|\
95- LeaveWindowMask
96-
97-/* Useful macros */
98-#define START_ICONIC(c) \
99- ((c->wmhints) && \
100- (c->wmhints->initial_state == IconicState) && \
101- !clientIsTransientOrModal (c))
102-
103-#define OPACITY_SET_STEP (guint) 0x16000000
104-#define OPACITY_SET_MIN (guint) 0x40000000
105-
106-typedef struct _ButtonPressData ButtonPressData;
107-struct _ButtonPressData
108-{
109- int b;
110- Client *c;
111-};
112-
113-/* Forward decl */
114-static void
115-clientUpdateIconPix (Client *c);
116-static gboolean
117-clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *, tilePositionType tile);
118-
119-Display *
120-clientGetXDisplay (Client *c)
121-{
122- g_return_val_if_fail (c, NULL);
123-
124- return myScreenGetXDisplay (c->screen_info);
125-}
126-
127-void
128-clientInstallColormaps (Client *c)
129-{
130- XWindowAttributes attr;
131- gboolean installed;
132- int i;
133-
134- g_return_if_fail (c != NULL);
135- TRACE ("entering clientInstallColormaps");
136-
137- installed = FALSE;
138- if (c->ncmap)
139- {
140- for (i = c->ncmap - 1; i >= 0; i--)
141- {
142- XGetWindowAttributes (clientGetXDisplay (c), c->cmap_windows[i], &attr);
143- XInstallColormap (clientGetXDisplay (c), attr.colormap);
144- if (c->cmap_windows[i] == c->window)
145- {
146- installed = TRUE;
147- }
148- }
149- }
150- if ((!installed) && (c->cmap))
151- {
152- XInstallColormap (clientGetXDisplay (c), c->cmap);
153- }
154-}
155-
156-void
157-clientUpdateColormaps (Client *c)
158-{
159- g_return_if_fail (c != NULL);
160- TRACE ("entering clientUpdateColormaps");
161-
162- if (c->ncmap)
163- {
164- XFree (c->cmap_windows);
165- c->ncmap = 0;
166- }
167- if (!XGetWMColormapWindows (clientGetXDisplay (c), c->window, &c->cmap_windows, &c->ncmap))
168- {
169- c->cmap_windows = NULL;
170- c->ncmap = 0;
171- }
172-}
173-
174-static gchar*
175-clientCreateTitleName (Client *c, gchar *name, gchar *hostname)
176-{
177- ScreenInfo *screen_info;
178- DisplayInfo *display_info;
179- gchar *title;
180-
181- g_return_val_if_fail (c != NULL, NULL);
182- TRACE ("entering clientCreateTitleName");
183-
184- screen_info = c->screen_info;
185- display_info = screen_info->display_info;
186-
187- if (strlen (hostname) && (display_info->hostname) && (g_ascii_strcasecmp (display_info->hostname, hostname)))
188- {
189- /* TRANSLATORS: "(on %s)" is like "running on" the name of the other host */
190- title = g_strdup_printf (_("%s (on %s)"), name, hostname);
191- }
192- else
193- {
194- title = g_strdup (name);
195- }
196-
197- return title;
198-}
199-
200-void
201-clientUpdateName (Client *c)
202-{
203- ScreenInfo *screen_info;
204- DisplayInfo *display_info;
205- gchar *hostname;
206- gchar *wm_name;
207- gchar *name;
208- gboolean refresh;
209-
210- g_return_if_fail (c != NULL);
211- TRACE ("entering clientUpdateName");
212-
213- screen_info = c->screen_info;
214- display_info = screen_info->display_info;
215-
216- getWindowName (display_info, c->window, &wm_name);
217- getWindowHostname (display_info, c->window, &hostname);
218- refresh = FALSE;
219-
220- /* Update hostname too, as it's used when terminating a client */
221- if (hostname)
222- {
223- if (c->hostname)
224- {
225- g_free (c->hostname);
226- }
227- c->hostname = hostname;
228- }
229-
230- if (wm_name)
231- {
232- name = clientCreateTitleName (c, wm_name, hostname);
233- g_free (wm_name);
234- if (c->name)
235- {
236- if (strcmp (name, c->name))
237- {
238- refresh = TRUE;
239- FLAG_SET (c->flags, CLIENT_FLAG_NAME_CHANGED);
240- }
241- g_free (c->name);
242- }
243- c->name = name;
244- }
245-
246- if (refresh)
247- {
248- frameQueueDraw (c, TRUE);
249- }
250-}
251-
252-void
253-clientUpdateAllFrames (ScreenInfo *screen_info, int mask)
254-{
255- Client *c;
256- XWindowChanges wc;
257- guint i;
258-
259- g_return_if_fail (screen_info != NULL);
260-
261- TRACE ("entering clientRedrawAllFrames");
262- for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
263- {
264- unsigned long configure_flags = 0L;
265-
266- if (mask & UPDATE_BUTTON_GRABS)
267- {
268- clientUngrabButtons (c);
269- clientGrabButtons (c);
270- clientGrabMouseButton (c);
271- }
272- if (mask & UPDATE_CACHE)
273- {
274- clientUpdateIconPix (c);
275- }
276- if (mask & UPDATE_GRAVITY)
277- {
278- clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y);
279- clientCoordGravitate (c, c->gravity, APPLY, &c->x, &c->y);
280- setNetFrameExtents (screen_info->display_info,
281- c->window,
282- frameTop (c),
283- frameLeft (c),
284- frameRight (c),
285- frameBottom (c));
286- configure_flags |= CFG_FORCE_REDRAW;
287- mask &= ~UPDATE_FRAME;
288- }
289- if (mask & UPDATE_MAXIMIZE)
290- {
291- unsigned long maximization_flags = 0L;
292-
293- /* Recompute size and position of maximized windows */
294- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT))
295- {
296- maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED;
297-
298- /* Force an update by clearing the internal flags */
299- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT);
300- clientToggleMaximized (c, maximization_flags, FALSE);
301-
302- configure_flags |= CFG_FORCE_REDRAW;
303- mask &= ~UPDATE_FRAME;
304- }
305- }
306- if (configure_flags != 0L)
307- {
308- wc.x = c->x;
309- wc.y = c->y;
310- wc.width = c->width;
311- wc.height = c->height;
312- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, configure_flags);
313- }
314- if (mask & UPDATE_FRAME)
315- {
316- frameQueueDraw (c, TRUE);
317- }
318-
319- }
320-}
321-
322-void
323-clientGrabButtons (Client *c)
324-{
325- ScreenInfo *screen_info;
326-
327- g_return_if_fail (c != NULL);
328- TRACE ("entering clientGrabButtons");
329- TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window);
330-
331- screen_info = c->screen_info;
332- if (screen_info->params->easy_click)
333- {
334- grabButton(clientGetXDisplay (c), AnyButton, screen_info->params->easy_click, c->window);
335- }
336-}
337-
338-void
339-clientUngrabButtons (Client *c)
340-{
341- g_return_if_fail (c != NULL);
342- TRACE ("entering clientUngrabButtons");
343- TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window);
344-
345- XUngrabButton (clientGetXDisplay (c), AnyButton, AnyModifier, c->window);
346-}
347-
348-static gboolean
349-urgent_cb (gpointer data)
350-{
351- Client *c;
352- ScreenInfo *screen_info;
353-
354- c = (Client *) data;
355- g_return_val_if_fail (c != NULL, FALSE);
356- TRACE ("entering urgent_cb, iteration %i", c->blink_iterations);
357- screen_info = c->screen_info;
358-
359- if (c != clientGetFocus ())
360- {
361- /*
362- * If we do not blink on urgency, check if the window was last
363- * drawn focused and redraw it unfocused.
364- * This is for th case when the tuser changes the settings
365- * in between two redraws.
366- */
367- if (!screen_info->params->urgent_blink)
368- {
369- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE))
370- {
371- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
372- frameQueueDraw (c, FALSE);
373- }
374-
375- if (c->blink_iterations)
376- {
377- c->blink_iterations = 0;
378- }
379- return TRUE;
380- }
381- /*
382- * If we blink on urgency, check if we've not reach the number
383- * of iterations and if not, simply change the status and redraw
384- */
385- if (c->blink_iterations < (2 * MAX_BLINK_ITERATIONS))
386- {
387- c->blink_iterations++;
388- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
389- frameQueueDraw (c, FALSE);
390- return TRUE;
391- }
392- /*
393- * If we reached the max number of iterations, check if we
394- * repeat. If repeat_urgent_blink is set, redraw the frame and
395- * restart counting from 1
396- */
397- if (screen_info->params->repeat_urgent_blink)
398- {
399- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
400- frameQueueDraw (c, FALSE);
401- c->blink_iterations = 1;
402- return TRUE;
403- }
404- }
405- else if (c->blink_iterations)
406- {
407- c->blink_iterations = 0;
408- }
409- return (TRUE);
410-}
411-
412-void
413-clientUpdateUrgency (Client *c)
414-{
415- g_return_if_fail (c != NULL);
416-
417- TRACE ("entering clientUpdateUrgency");
418-
419- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
420- if (c->blink_timeout_id)
421- {
422- g_source_remove (c->blink_timeout_id);
423- frameQueueDraw (c, FALSE);
424- }
425- FLAG_UNSET (c->wm_flags, WM_FLAG_URGENT);
426-
427- c->blink_timeout_id = 0;
428- c->blink_iterations = 0;
429- if ((c->wmhints) && (c->wmhints->flags & XUrgencyHint))
430- {
431- FLAG_SET (c->wm_flags, WM_FLAG_URGENT);
432- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
433- {
434- c->blink_timeout_id =
435- g_timeout_add_full (G_PRIORITY_DEFAULT,
436- CLIENT_BLINK_TIMEOUT,
437- (GtkFunction) urgent_cb,
438- (gpointer) c, NULL);
439- }
440- }
441- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE)
442- && !FLAG_TEST (c->wm_flags, WM_FLAG_URGENT)
443- && (c != clientGetFocus ()))
444- {
445- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
446- frameQueueDraw (c, FALSE);
447- }
448-}
449-
450-void
451-clientCoordGravitate (Client *c, int gravity, int mode, int *x, int *y)
452-{
453- int dx, dy;
454-
455- g_return_if_fail (c != NULL);
456- TRACE ("entering clientCoordGravitate");
457-
458- switch (gravity)
459- {
460- case CenterGravity:
461- dx = (c->border_width * 2) - ((frameLeft (c) +
462- frameRight (c)) / 2);
463- dy = (c->border_width * 2) - ((frameTop (c) +
464- frameBottom (c)) / 2);
465- break;
466- case NorthGravity:
467- dx = (c->border_width * 2) - ((frameLeft (c) +
468- frameRight (c)) / 2);
469- dy = frameTop (c);
470- break;
471- case SouthGravity:
472- dx = (c->border_width * 2) - ((frameLeft (c) +
473- frameRight (c)) / 2);
474- dy = (c->border_width * 2) - frameBottom (c);
475- break;
476- case EastGravity:
477- dx = (c->border_width * 2) - frameRight (c);
478- dy = (c->border_width * 2) - ((frameTop (c) +
479- frameBottom (c)) / 2);
480- break;
481- case WestGravity:
482- dx = frameLeft (c);
483- dy = (c->border_width * 2) - ((frameTop (c) +
484- frameBottom (c)) / 2);
485- break;
486- case NorthWestGravity:
487- dx = frameLeft (c);
488- dy = frameTop (c);
489- break;
490- case NorthEastGravity:
491- dx = (c->border_width * 2) - frameRight (c);
492- dy = frameTop (c);
493- break;
494- case SouthWestGravity:
495- dx = frameLeft (c);
496- dy = (c->border_width * 2) - frameBottom (c);
497- break;
498- case SouthEastGravity:
499- dx = (c->border_width * 2) - frameRight (c);
500- dy = (c->border_width * 2) - frameBottom (c);
501- break;
502- default:
503- dx = 0;
504- dy = 0;
505- break;
506- }
507- *x = *x + (dx * mode);
508- *y = *y + (dy * mode);
509-}
510-
511-void
512-clientAdjustCoordGravity (Client *c, int gravity, unsigned long *mask, XWindowChanges *wc)
513-{
514- int tx, ty, dw, dh;
515-
516- g_return_if_fail (c != NULL);
517- TRACE ("entering clientAdjustCoordGravity");
518-
519- tx = wc->x;
520- ty = wc->y;
521- clientCoordGravitate (c, gravity, APPLY, &tx, &ty);
522-
523- switch (gravity)
524- {
525- case CenterGravity:
526- dw = (c->width - wc->width) / 2;
527- dh = (c->height - wc->height) / 2;
528- break;
529- case NorthGravity:
530- dw = (c->width - wc->width) / 2;
531- dh = 0;
532- break;
533- case SouthGravity:
534- dw = (c->width - wc->width) / 2;
535- dh = (c->height - wc->height);
536- break;
537- case EastGravity:
538- dw = (c->width - wc->width);
539- dh = (c->height - wc->height) / 2;
540- break;
541- case WestGravity:
542- dw = 0;
543- dh = (c->height - wc->height) / 2;
544- break;
545- case NorthWestGravity:
546- dw = 0;
547- dh = 0;
548- break;
549- case NorthEastGravity:
550- dw = (c->width - wc->width);
551- dh = 0;
552- break;
553- case SouthWestGravity:
554- dw = 0;
555- dh = (c->height - wc->height);
556- break;
557- case SouthEastGravity:
558- dw = (c->width - wc->width);
559- dh = (c->height - wc->height);
560- break;
561- default:
562- dw = 0;
563- dh = 0;
564- break;
565- }
566-
567- if (*mask & CWX)
568- {
569- wc->x = tx;
570- }
571- else if (*mask & CWWidth)
572- {
573- wc->x = c->x + dw;
574- *mask |= CWX;
575- }
576-
577- if (*mask & CWY)
578- {
579- wc->y = ty;
580- }
581- else if (*mask & CWHeight)
582- {
583- wc->y = c->y + dh;
584- *mask |= CWY;
585- }
586-}
587-
588-#define WIN_MOVED (mask & (CWX | CWY))
589-#define WIN_RESIZED (mask & (CWWidth | CWHeight))
590-
591-static void
592-clientConfigureWindows (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
593-{
594- unsigned long change_mask_frame, change_mask_client;
595- XWindowChanges change_values;
596- DisplayInfo *display_info;
597- ScreenInfo *screen_info;
598-
599- screen_info = c->screen_info;
600- display_info = screen_info->display_info;
601-
602- change_mask_frame = mask & (CWX | CWY | CWWidth | CWHeight);
603- change_mask_client = mask & (CWWidth | CWHeight);
604-
605- if ((WIN_RESIZED) || (flags & CFG_FORCE_REDRAW))
606- {
607- frameDraw (c, (flags & CFG_FORCE_REDRAW));
608- }
609-
610- if (flags & CFG_FORCE_REDRAW)
611- {
612- change_mask_client |= (CWX | CWY);
613- }
614-
615- if (change_mask_frame & (CWX | CWY | CWWidth | CWHeight))
616- {
617- change_values.x = frameX (c);
618- change_values.y = frameY (c);
619- change_values.width = frameWidth (c);
620- change_values.height = frameHeight (c);
621- XConfigureWindow (display_info->dpy, c->frame, change_mask_frame, &change_values);
622- }
623-
624- if (change_mask_client & (CWX | CWY | CWWidth | CWHeight))
625- {
626- change_values.x = frameLeft (c);
627- change_values.y = frameTop (c);
628- change_values.width = c->width;
629- change_values.height = c->height;
630- XConfigureWindow (display_info->dpy, c->window, change_mask_client, &change_values);
631- }
632- if (WIN_RESIZED)
633- {
634- compositorResizeWindow (display_info, c->frame, frameX (c), frameY (c), frameWidth (c), frameHeight (c));
635- }
636-}
637-
638-void
639-clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
640-{
641- XConfigureEvent ce;
642- int px, py, pwidth, pheight;
643-
644- g_return_if_fail (c != NULL);
645- g_return_if_fail (c->window != None);
646-
647- TRACE ("entering clientConfigure");
648- TRACE ("configuring client \"%s\" (0x%lx) %s, type %u", c->name,
649- c->window, flags & CFG_CONSTRAINED ? "constrained" : "not contrained", c->type);
650-
651- px = c->x;
652- py = c->y;
653- pwidth = c->width;
654- pheight = c->height;
655-
656- if (mask & CWX)
657- {
658- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING))
659- {
660- c->x = wc->x;
661- }
662- }
663- if (mask & CWY)
664- {
665- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING))
666- {
667- c->y = wc->y;
668- }
669- }
670- if (mask & CWWidth)
671- {
672- clientSetWidth (c, wc->width, flags & CFG_REQUEST);
673- }
674- if (mask & CWHeight)
675- {
676- clientSetHeight (c, wc->height, flags & CFG_REQUEST);
677- }
678- if (mask & CWBorderWidth)
679- {
680- c->border_width = wc->border_width;
681- }
682- if (mask & CWStackMode)
683- {
684- switch (wc->stack_mode)
685- {
686- /*
687- * Limitation: we don't support neither
688- * TopIf, BottomIf nor Opposite ...
689- */
690- case Above:
691- TRACE ("Above");
692- if (mask & CWSibling)
693- {
694- clientRaise (c, wc->sibling);
695- }
696- else
697- {
698- clientRaise (c, None);
699- }
700- break;
701- case Below:
702- TRACE ("Below");
703- if (mask & CWSibling)
704- {
705- clientLower (c, wc->sibling);
706- }
707- else
708- {
709- clientLower (c, None);
710- }
711-
712- break;
713- case Opposite:
714- case TopIf:
715- case BottomIf:
716- default:
717- break;
718- }
719- }
720- mask &= ~(CWStackMode | CWSibling);
721-
722- /* Keep control over what the application does. */
723- if (((flags & (CFG_CONSTRAINED | CFG_REQUEST)) == (CFG_CONSTRAINED | CFG_REQUEST))
724- && CONSTRAINED_WINDOW (c))
725- {
726- clientConstrainPos (c, flags & CFG_KEEP_VISIBLE);
727-
728- if (c->x != px)
729- {
730- mask |= CWX;
731- }
732- else
733- {
734- mask &= ~CWX;
735- }
736-
737- if (c->y != py)
738- {
739- mask |= CWY;
740- }
741- else
742- {
743- mask &= ~CWY;
744- }
745-
746- if (c->width != pwidth)
747- {
748- mask |= CWWidth;
749- }
750- else
751- {
752- mask &= ~CWWidth;
753- }
754- if (c->height != pheight)
755- {
756- mask |= CWHeight;
757- }
758- else
759- {
760- mask &= ~CWHeight;
761- }
762- }
763-
764- clientConfigureWindows (c, wc, mask, flags);
765- /*
766-
767- We reparent the client window. According to the ICCCM spec, the
768- WM must send a senthetic event when the window is moved and not resized.
769-
770- But, since we reparent the window, we must also send a synthetic
771- configure event when the window is moved and resized.
772-
773- See this thread for the rational:
774- http://www.mail-archive.com/wm-spec-list@gnome.org/msg00379.html
775-
776- And specifically this post from Carsten Haitzler:
777- http://www.mail-archive.com/wm-spec-list@gnome.org/msg00382.html
778-
779- */
780- if ((WIN_MOVED) || (flags & CFG_NOTIFY) ||
781- ((flags & CFG_REQUEST) && !(WIN_MOVED || WIN_RESIZED)))
782- {
783- DBG ("Sending ConfigureNotify");
784- ce.type = ConfigureNotify;
785- ce.display = clientGetXDisplay (c);
786- ce.event = c->window;
787- ce.window = c->window;
788- ce.x = c->x;
789- ce.y = c->y;
790- ce.width = c->width;
791- ce.height = c->height;
792- ce.border_width = 0;
793- ce.above = c->frame;
794- ce.override_redirect = FALSE;
795- XSendEvent (clientGetXDisplay (c), c->window, FALSE,
796- StructureNotifyMask, (XEvent *) & ce);
797- }
798-#undef WIN_MOVED
799-#undef WIN_RESIZED
800-}
801-
802-void
803-clientMoveResizeWindow (Client *c, XWindowChanges * wc, unsigned long mask)
804-{
805- ScreenInfo *screen_info;
806- DisplayInfo *display_info;
807- unsigned short flags;
808-
809- g_return_if_fail (c != NULL);
810- TRACE ("entering clientMoveResizeWindow");
811- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
812-
813- screen_info = c->screen_info;
814- display_info = screen_info->display_info;
815- if (c->type == WINDOW_DESKTOP)
816- {
817- /* Ignore stacking request for DESKTOP windows */
818- mask &= ~(CWSibling | CWStackMode);
819- }
820- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
821- || (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
822- && (screen_info->params->borderless_maximize)))
823- {
824- /* Not allowed in fullscreen or maximzed mode */
825- mask &= ~(CWX | CWY | CWWidth | CWHeight);
826- }
827- /*clean up buggy requests that set all flags */
828- if ((mask & CWX) && (wc->x == c->x))
829- {
830- mask &= ~CWX;
831- }
832- if ((mask & CWY) && (wc->y == c->y))
833- {
834- mask &= ~CWY;
835- }
836- if ((mask & CWWidth) && (wc->width == c->width))
837- {
838- mask &= ~CWWidth;
839- }
840- if ((mask & CWHeight) && (wc->height == c->height))
841- {
842- mask &= ~CWHeight;
843- }
844-
845- /* Still a move/resize after cleanup? */
846- flags = CFG_REQUEST;
847- if (mask & (CWX | CWY | CWWidth | CWHeight))
848- {
849- /* Clear any previously saved pos flag from screen resize */
850- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SAVED_POS);
851-
852- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
853- {
854- clientRemoveMaximizeFlag (c);
855- }
856-
857- flags |= CFG_REQUEST | CFG_CONSTRAINED;
858- }
859- if ((mask & (CWWidth | CWHeight)) && !(mask & (CWX | CWY)))
860- {
861- /*
862- * The client is resizing its window, but did not specify a
863- * position, make sure the window remains fully visible in that
864- *case so that the user does not have to relocate the window
865- */
866- flags |= CFG_KEEP_VISIBLE;
867- }
868- /*
869- * Let's say that if the client performs a XRaiseWindow, we show the window if focus
870- * stealing prevention is not activated, otherwise we just set the "demands attention"
871- * flag...
872- */
873- if ((mask & CWStackMode) && (wc->stack_mode == Above) && (wc->sibling == None) && !(c->type & WINDOW_TYPE_DONT_FOCUS))
874- {
875- Client *last_raised;
876-
877- last_raised = clientGetLastRaise (screen_info);
878- if (last_raised && (c != last_raised))
879- {
880- if ((screen_info->params->prevent_focus_stealing) && (screen_info->params->activate_action == ACTIVATE_ACTION_NONE))
881- {
882- mask &= ~(CWSibling | CWStackMode);
883- TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
884- FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
885- clientSetNetState (c);
886- }
887- else
888- {
889- clientActivate (c, getXServerTime (display_info), FALSE);
890- }
891- }
892- }
893- /* And finally, configure the window */
894- clientConfigure (c, wc, mask, flags);
895-}
896-
897-void
898-clientGetMWMHints (Client *c, gboolean update)
899-{
900- ScreenInfo *screen_info;
901- DisplayInfo *display_info;
902- PropMwmHints *mwm_hints;
903- XWindowChanges wc;
904-
905- g_return_if_fail (c != NULL);
906- g_return_if_fail (c->window != None);
907-
908- TRACE ("entering clientGetMWMHints client \"%s\" (0x%lx)", c->name,
909- c->window);
910-
911- screen_info = c->screen_info;
912- display_info = screen_info->display_info;
913-
914- mwm_hints = getMotifHints (display_info, c->window);
915- if (mwm_hints)
916- {
917- if ((mwm_hints->flags & MWM_HINTS_DECORATIONS))
918- {
919- if (!FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
920- {
921- if (mwm_hints->decorations & MWM_DECOR_ALL)
922- {
923- FLAG_SET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
924- }
925- else
926- {
927- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
928- FLAG_SET (c->xfwm_flags, (mwm_hints-> decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER))
929- ? XFWM_FLAG_HAS_BORDER : 0);
930- FLAG_SET (c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MENU))
931- ? XFWM_FLAG_HAS_MENU : 0);
932- /*
933- FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
934- FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE);
935- FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MINIMIZE)) ? XFWM_FLAG_HAS_HIDE : 0);
936- FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MAXIMIZE)) ? XFWM_FLAG_HAS_MAXIMIZE : 0);
937- */
938- }
939- }
940- }
941- /* The following is from Metacity : */
942- if (mwm_hints->flags & MWM_HINTS_FUNCTIONS)
943- {
944- if (!(mwm_hints->functions & MWM_FUNC_ALL))
945- {
946- FLAG_UNSET (c->xfwm_flags,
947- XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE |
948- XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE |
949- XFWM_FLAG_HAS_RESIZE);
950- }
951- else
952- {
953- FLAG_SET (c->xfwm_flags,
954- XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE |
955- XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE |
956- XFWM_FLAG_HAS_RESIZE);
957- }
958-
959- if (mwm_hints->functions & MWM_FUNC_CLOSE)
960- {
961- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_CLOSE);
962- }
963- if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
964- {
965- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
966- }
967- if (mwm_hints->functions & MWM_FUNC_MAXIMIZE)
968- {
969- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE);
970- }
971- if (mwm_hints->functions & MWM_FUNC_RESIZE)
972- {
973- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_RESIZE);
974- }
975- if (mwm_hints->functions & MWM_FUNC_MOVE)
976- {
977- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MOVE);
978- }
979- }
980- g_free (mwm_hints);
981- }
982-
983- if (update)
984- {
985- wc.x = c->x;
986- wc.y = c->y;
987- wc.width = c->width;
988- wc.height = c->height;
989-
990- /* If client is maximized, we need to update its coordonates and size as well */
991- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
992- {
993- GdkRectangle rect;
994- myScreenFindMonitorAtPoint (screen_info,
995- frameX (c) + (frameWidth (c) / 2),
996- frameY (c) + (frameHeight (c) / 2), &rect);
997- clientNewMaxSize (c, &wc, &rect, TILE_NONE);
998- }
999-
1000- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW);
1001-
1002- /* MWM hints can add or remove decorations, update NET_FRAME_EXTENTS accordingly */
1003- setNetFrameExtents (display_info,
1004- c->window,
1005- frameTop (c),
1006- frameLeft (c),
1007- frameRight (c),
1008- frameBottom (c));
1009- }
1010-}
1011-
1012-void
1013-clientGetWMNormalHints (Client *c, gboolean update)
1014-{
1015- XWindowChanges wc;
1016- unsigned long previous_value;
1017- long dummy;
1018-
1019- g_return_if_fail (c != NULL);
1020- g_return_if_fail (c->window != None);
1021-
1022- TRACE ("entering clientGetWMNormalHints client \"%s\" (0x%lx)", c->name,
1023- c->window);
1024-
1025- if (!c->size)
1026- {
1027- c->size = XAllocSizeHints ();
1028- }
1029- g_assert (c->size);
1030-
1031- dummy = 0;
1032- if (!XGetWMNormalHints (clientGetXDisplay (c), c->window, c->size, &dummy))
1033- {
1034- c->size->flags = 0;
1035- }
1036-
1037- /* Set/update gravity */
1038- c->gravity = c->size->flags & PWinGravity ? c->size->win_gravity : NorthWestGravity;
1039-
1040- previous_value = FLAG_TEST (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
1041- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
1042-
1043- wc.x = c->x;
1044- wc.y = c->y;
1045- wc.width = c->width;
1046- wc.height = c->height;
1047-
1048- if (!(c->size->flags & PMaxSize))
1049- {
1050- c->size->max_width = G_MAXINT;
1051- c->size->max_height = G_MAXINT;
1052- c->size->flags |= PMaxSize;
1053- }
1054-
1055- if (!(c->size->flags & PBaseSize))
1056- {
1057- c->size->base_width = 0;
1058- c->size->base_height = 0;
1059- }
1060-
1061- if (!(c->size->flags & PMinSize))
1062- {
1063- if ((c->size->flags & PBaseSize))
1064- {
1065- c->size->min_width = c->size->base_width;
1066- c->size->min_height = c->size->base_height;
1067- }
1068- else
1069- {
1070- c->size->min_width = 1;
1071- c->size->min_height = 1;
1072- }
1073- c->size->flags |= PMinSize;
1074- }
1075-
1076- if (c->size->flags & PResizeInc)
1077- {
1078- if (c->size->width_inc < 1)
1079- {
1080- c->size->width_inc = 1;
1081- }
1082- if (c->size->height_inc < 1)
1083- {
1084- c->size->height_inc = 1;
1085- }
1086- }
1087- else
1088- {
1089- c->size->width_inc = 1;
1090- c->size->height_inc = 1;
1091- }
1092-
1093- if (c->size->flags & PAspect)
1094- {
1095- if (c->size->min_aspect.x < 1)
1096- {
1097- c->size->min_aspect.x = 1;
1098- }
1099- if (c->size->min_aspect.y < 1)
1100- {
1101- c->size->min_aspect.y = 1;
1102- }
1103- if (c->size->max_aspect.x < 1)
1104- {
1105- c->size->max_aspect.x = 1;
1106- }
1107- if (c->size->max_aspect.y < 1)
1108- {
1109- c->size->max_aspect.y = 1;
1110- }
1111- }
1112- else
1113- {
1114- c->size->min_aspect.x = 1;
1115- c->size->min_aspect.y = 1;
1116- c->size->max_aspect.x = G_MAXINT;
1117- c->size->max_aspect.y = G_MAXINT;
1118- }
1119-
1120- if (c->size->min_width < 1)
1121- {
1122- c->size->min_width = 1;
1123- }
1124- if (c->size->min_height < 1)
1125- {
1126- c->size->min_height = 1;
1127- }
1128- if (c->size->max_width < 1)
1129- {
1130- c->size->max_width = 1;
1131- }
1132- if (c->size->max_height < 1)
1133- {
1134- c->size->max_height = 1;
1135- }
1136- if (wc.width > c->size->max_width)
1137- {
1138- wc.width = c->size->max_width;
1139- }
1140- if (wc.height > c->size->max_height)
1141- {
1142- wc.height = c->size->max_height;
1143- }
1144- if (wc.width < c->size->min_width)
1145- {
1146- wc.width = c->size->min_width;
1147- }
1148- if (wc.height < c->size->min_height)
1149- {
1150- wc.height = c->size->min_height;
1151- }
1152-
1153- if ((c->size->min_width < c->size->max_width) ||
1154- (c->size->min_height < c->size->max_height))
1155- {
1156- FLAG_SET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
1157- }
1158-
1159- if (update)
1160- {
1161- if ((c->width != wc.width) || (c->height != wc.height))
1162- {
1163- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
1164- {
1165- clientRemoveMaximizeFlag (c);
1166- }
1167- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_CONSTRAINED | CFG_FORCE_REDRAW);
1168- }
1169- else if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE) != previous_value)
1170- {
1171- frameQueueDraw (c, FALSE);
1172- }
1173- }
1174- else
1175- {
1176- c->width = wc.width;
1177- c->height = wc.height;
1178- }
1179-}
1180-
1181-void
1182-clientGetWMProtocols (Client *c)
1183-{
1184- ScreenInfo *screen_info;
1185- DisplayInfo *display_info;
1186- unsigned int wm_protocols_flags;
1187-
1188- g_return_if_fail (c != NULL);
1189- g_return_if_fail (c->window != None);
1190-
1191- TRACE ("entering clientGetWMProtocols client \"%s\" (0x%lx)", c->name,
1192- c->window);
1193-
1194- screen_info = c->screen_info;
1195- display_info = screen_info->display_info;
1196-
1197- wm_protocols_flags = getWMProtocols (display_info, c->window);
1198- FLAG_SET (c->wm_flags,
1199- (wm_protocols_flags & WM_PROTOCOLS_DELETE_WINDOW) ?
1200- WM_FLAG_DELETE : 0);
1201- FLAG_SET (c->wm_flags,
1202- (wm_protocols_flags & WM_PROTOCOLS_TAKE_FOCUS) ?
1203- WM_FLAG_TAKEFOCUS : 0);
1204- /* KDE extension */
1205- FLAG_SET (c->wm_flags,
1206- (wm_protocols_flags & WM_PROTOCOLS_CONTEXT_HELP) ?
1207- WM_FLAG_CONTEXT_HELP : 0);
1208- /* Ping */
1209- FLAG_SET (c->wm_flags,
1210- (wm_protocols_flags & WM_PROTOCOLS_PING) ?
1211- WM_FLAG_PING : 0);
1212-}
1213-
1214-static void
1215-clientFree (Client *c)
1216-{
1217- g_return_if_fail (c != NULL);
1218-
1219- TRACE ("entering clientFree");
1220- TRACE ("freeing client \"%s\" (0x%lx)", c->name, c->window);
1221-
1222- clientClearFocus (c);
1223- if (clientGetLastRaise (c->screen_info) == c)
1224- {
1225- clientClearLastRaise (c->screen_info);
1226- }
1227- if (clientGetDelayedFocus () == c)
1228- {
1229- clientClearDelayedFocus ();
1230- }
1231- if (c->blink_timeout_id)
1232- {
1233- g_source_remove (c->blink_timeout_id);
1234- }
1235- if (c->icon_timeout_id)
1236- {
1237- g_source_remove (c->icon_timeout_id);
1238- }
1239- if (c->frame_timeout_id)
1240- {
1241- g_source_remove (c->frame_timeout_id);
1242- }
1243- if (c->ping_timeout_id)
1244- {
1245- clientRemoveNetWMPing (c);
1246- }
1247- if (c->name)
1248- {
1249- g_free (c->name);
1250- }
1251- if (c->hostname)
1252- {
1253- g_free (c->hostname);
1254- }
1255-#ifdef HAVE_XSYNC
1256- if (c->xsync_alarm != None)
1257- {
1258- clientDestroyXSyncAlarm (c);
1259- }
1260- if (c->xsync_timeout_id)
1261- {
1262- g_source_remove (c->xsync_timeout_id);
1263- }
1264-#endif /* HAVE_XSYNC */
1265-#ifdef HAVE_LIBSTARTUP_NOTIFICATION
1266- if (c->startup_id)
1267- {
1268- g_free (c->startup_id);
1269- }
1270-#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
1271- if (c->size)
1272- {
1273- XFree (c->size);
1274- }
1275- if (c->wmhints)
1276- {
1277- XFree (c->wmhints);
1278- }
1279- if ((c->ncmap > 0) && (c->cmap_windows))
1280- {
1281- XFree (c->cmap_windows);
1282- }
1283- if (c->class.res_name)
1284- {
1285- XFree (c->class.res_name);
1286- }
1287- if (c->class.res_class)
1288- {
1289- XFree (c->class.res_class);
1290- }
1291- if (c->dialog_pid)
1292- {
1293- kill (c->dialog_pid, SIGKILL);
1294- }
1295- if (c->dialog_fd >= 0)
1296- {
1297- close (c->dialog_fd);
1298- }
1299-
1300- g_free (c);
1301-}
1302-
1303-static void
1304-clientApplyInitialState (Client *c)
1305-{
1306- g_return_if_fail (c != NULL);
1307-
1308- TRACE ("entering clientApplyInitialState");
1309-
1310- /* We check that afterwards to make sure all states are now known */
1311- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
1312- {
1313- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE))
1314- {
1315- unsigned long mode = 0L;
1316-
1317- TRACE ("Applying client's initial state: maximized");
1318- mode = c->flags & CLIENT_FLAG_MAXIMIZED;
1319-
1320- /* Unset fullscreen mode so that clientToggleMaximized() really change the state */
1321- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED);
1322- clientToggleMaximized (c, mode, FALSE);
1323- }
1324- }
1325- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
1326- {
1327- TRACE ("Applying client's initial state: fullscreen");
1328- clientUpdateFullscreenState (c);
1329- }
1330- if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_ABOVE, CLIENT_FLAG_BELOW))
1331- {
1332- TRACE ("Applying client's initial state: above");
1333- clientUpdateLayerState (c);
1334- }
1335- if (FLAG_TEST_AND_NOT (c->flags, CLIENT_FLAG_BELOW, CLIENT_FLAG_ABOVE))
1336- {
1337- TRACE ("Applying client's initial state: below");
1338- clientUpdateLayerState (c);
1339- }
1340- if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY) &&
1341- FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_STICK))
1342- {
1343- TRACE ("Applying client's initial state: sticky");
1344- clientStick (c, TRUE);
1345- }
1346- if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
1347- {
1348- TRACE ("Applying client's initial state: shaded");
1349- clientShade (c);
1350- }
1351-}
1352-
1353-static gboolean
1354-clientCheckShape (Client *c)
1355-{
1356- ScreenInfo *screen_info;
1357- DisplayInfo *display_info;
1358- int xws, yws, xbs, ybs;
1359- unsigned wws, hws, wbs, hbs;
1360- int boundingShaped, clipShaped;
1361-
1362- g_return_val_if_fail (c != NULL, FALSE);
1363-
1364- screen_info = c->screen_info;
1365- display_info = screen_info->display_info;
1366-
1367- if (display_info->have_shape)
1368- {
1369- XShapeQueryExtents (display_info->dpy, c->window, &boundingShaped, &xws, &yws, &wws,
1370- &hws, &clipShaped, &xbs, &ybs, &wbs, &hbs);
1371- return (boundingShaped != 0);
1372- }
1373- return FALSE;
1374-}
1375-
1376-static void
1377-clientUpdateIconPix (Client *c)
1378-{
1379- ScreenInfo *screen_info;
1380- DisplayInfo *display_info;
1381- gint size;
1382- GdkPixbuf *icon;
1383- int i;
1384-
1385- g_return_if_fail (c != NULL);
1386- g_return_if_fail (c->window != None);
1387-
1388- TRACE ("entering clientUpdateIconPix for \"%s\" (0x%lx)", c->name, c->window);
1389-
1390- screen_info = c->screen_info;
1391- display_info = screen_info->display_info;
1392-
1393- for (i = 0; i < STATE_TOGGLED; i++)
1394- {
1395- xfwmPixmapFree (&c->appmenu[i]);
1396- }
1397-
1398- if (xfwmPixmapNone(&screen_info->buttons[MENU_BUTTON][ACTIVE]))
1399- {
1400- /* The current theme has no menu button */
1401- return;
1402- }
1403-
1404- for (i = 0; i < STATE_TOGGLED; i++)
1405- {
1406- if (!xfwmPixmapNone(&screen_info->buttons[MENU_BUTTON][i]))
1407- {
1408- xfwmPixmapDuplicate (&screen_info->buttons[MENU_BUTTON][i], &c->appmenu[i]);
1409- }
1410- }
1411- size = MIN (screen_info->buttons[MENU_BUTTON][ACTIVE].width,
1412- screen_info->buttons[MENU_BUTTON][ACTIVE].height);
1413-
1414- if (size > 1)
1415- {
1416- icon = getAppIcon (display_info, c->window, size, size);
1417-
1418- for (i = 0; i < STATE_TOGGLED; i++)
1419- {
1420- if (!xfwmPixmapNone(&c->appmenu[i]))
1421- {
1422- xfwmPixmapRenderGdkPixbuf (&c->appmenu[i], icon);
1423- }
1424- }
1425- g_object_unref (icon);
1426- }
1427-}
1428-
1429-static gboolean
1430-update_icon_idle_cb (gpointer data)
1431-{
1432- Client *c;
1433-
1434- TRACE ("entering update_icon_idle_cb");
1435-
1436- c = (Client *) data;
1437- g_return_val_if_fail (c, FALSE);
1438-
1439- clientUpdateIconPix (c);
1440- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
1441- {
1442- frameQueueDraw (c, FALSE);
1443- }
1444- c->icon_timeout_id = 0;
1445-
1446- return (FALSE);
1447-}
1448-
1449-void
1450-clientUpdateIcon (Client *c)
1451-{
1452- g_return_if_fail (c);
1453-
1454- TRACE ("entering clientUpdateIcon for \"%s\" (0x%lx)", c->name, c->window);
1455-
1456- if (c->icon_timeout_id == 0)
1457- {
1458- c->icon_timeout_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
1459- update_icon_idle_cb, c, NULL);
1460- }
1461-}
1462-
1463-void
1464-clientSaveSizePos (Client *c)
1465-{
1466- g_return_if_fail (c != NULL);
1467-
1468- if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ) && !FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT))
1469- {
1470- c->old_x = c->x;
1471- c->old_width = c->width;
1472- c->old_y = c->y;
1473- c->old_height = c->height;
1474- }
1475-}
1476-
1477-Client *
1478-clientFrame (DisplayInfo *display_info, Window w, gboolean recapture)
1479-{
1480- ScreenInfo *screen_info;
1481- XWindowAttributes attr;
1482- XWindowChanges wc;
1483- XSetWindowAttributes attributes;
1484- Client *c = NULL;
1485- gboolean shaped;
1486- unsigned long valuemask;
1487- long pid;
1488- int i;
1489-
1490- g_return_val_if_fail (w != None, NULL);
1491- g_return_val_if_fail (display_info != NULL, NULL);
1492-
1493- TRACE ("entering clientFrame");
1494- TRACE ("framing client (0x%lx)", w);
1495-
1496- gdk_error_trap_push ();
1497- myDisplayGrabServer (display_info);
1498-
1499- if (!XGetWindowAttributes (display_info->dpy, w, &attr))
1500- {
1501- g_warning ("Cannot get window attributes for window (0x%lx)", w);
1502- myDisplayUngrabServer (display_info);
1503- gdk_error_trap_pop ();
1504- return NULL;
1505- }
1506-
1507- screen_info = myDisplayGetScreenFromRoot (display_info, attr.root);
1508- if (!screen_info)
1509- {
1510- g_warning ("Cannot determine screen info from window (0x%lx)", w);
1511- myDisplayUngrabServer (display_info);
1512- gdk_error_trap_pop ();
1513- return NULL;
1514- }
1515-
1516- if (w == screen_info->xfwm4_win)
1517- {
1518- TRACE ("Not managing our own event window");
1519- compositorAddWindow (display_info, w, NULL);
1520- myDisplayUngrabServer (display_info);
1521- gdk_error_trap_pop ();
1522- return NULL;
1523- }
1524-
1525-#ifdef ENABLE_KDE_SYSTRAY_PROXY
1526- if (checkKdeSystrayWindow (display_info, w))
1527- {
1528- TRACE ("Detected KDE systray windows");
1529- if (screen_info->systray != None)
1530- {
1531- sendSystrayReqDock (display_info, w, screen_info->systray);
1532- myDisplayUngrabServer (display_info);
1533- gdk_error_trap_pop ();
1534- return NULL;
1535- }
1536- TRACE ("No systray found for this screen");
1537- }
1538-#endif /* ENABLE_KDE_SYSTRAY_PROXY */
1539-
1540- if (attr.override_redirect)
1541- {
1542- TRACE ("Override redirect window 0x%lx", w);
1543- compositorAddWindow (display_info, w, NULL);
1544- myDisplayUngrabServer (display_info);
1545- gdk_error_trap_pop ();
1546- return NULL;
1547- }
1548-
1549- c = g_new0 (Client, 1);
1550- if (!c)
1551- {
1552- TRACE ("Cannot allocate memory for the window structure");
1553- myDisplayUngrabServer (display_info);
1554- gdk_error_trap_pop ();
1555- return NULL;
1556- }
1557-
1558- c->window = w;
1559- c->screen_info = screen_info;
1560- c->serial = screen_info->client_serial++;
1561-
1562- /* Termination dialog */
1563- c->dialog_pid = 0;
1564- c->dialog_fd = -1;
1565-
1566- getWindowName (display_info, c->window, &c->name);
1567- getWindowHostname (display_info, c->window, &c->hostname);
1568- getTransientFor (display_info, screen_info->xroot, c->window, &c->transient_for);
1569- XChangeSaveSet(display_info->dpy, c->window, SetModeInsert);
1570-
1571- /* Initialize structure */
1572- c->size = NULL;
1573- c->flags = 0L;
1574- c->wm_flags = 0L;
1575- c->xfwm_flags = XFWM_FLAG_INITIAL_VALUES;
1576- c->x = attr.x;
1577- c->y = attr.y;
1578- c->width = attr.width;
1579- c->height = attr.height;
1580-
1581-#ifdef HAVE_LIBSTARTUP_NOTIFICATION
1582- c->startup_id = NULL;
1583-#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
1584-
1585-#ifdef HAVE_XSYNC
1586- c->xsync_waiting = FALSE;
1587- c->xsync_enabled = FALSE;
1588- c->xsync_counter = None;
1589- c->xsync_alarm = None;
1590- c->xsync_timeout_id = 0;
1591- if (display_info->have_xsync)
1592- {
1593- getXSyncCounter (display_info, c->window, &c->xsync_counter);
1594- if ((c->xsync_counter) && clientCreateXSyncAlarm (c))
1595- {
1596- c->xsync_enabled = TRUE;
1597- }
1598- }
1599-#endif /* HAVE_XSYNC */
1600-
1601- clientGetWMNormalHints (c, FALSE);
1602-
1603- c->size->x = c->x;
1604- c->size->y = c->y;
1605- c->size->width = c->width;
1606- c->size->height = c->height;
1607- c->previous_width = -1;
1608- c->previous_height = -1;
1609- c->border_width = attr.border_width;
1610- c->cmap = attr.colormap;
1611-
1612- shaped = clientCheckShape(c);
1613- if (shaped)
1614- {
1615- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER);
1616- FLAG_SET (c->flags, CLIENT_FLAG_HAS_SHAPE);
1617- }
1618-
1619- if (((c->size->flags & (PMinSize | PMaxSize)) != (PMinSize | PMaxSize))
1620- || (((c->size->flags & (PMinSize | PMaxSize)) ==
1621- (PMinSize | PMaxSize))
1622- && ((c->size->min_width < c->size->max_width)
1623- || (c->size->min_height < c->size->max_height))))
1624- {
1625- FLAG_SET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
1626- }
1627-
1628- for (i = 0; i < BUTTON_COUNT; i++)
1629- {
1630- c->button_status[i] = BUTTON_STATE_NORMAL;
1631- }
1632-
1633- if (!XGetWMColormapWindows (display_info->dpy, c->window, &c->cmap_windows, &c->ncmap))
1634- {
1635- c->ncmap = 0;
1636- }
1637-
1638- c->fullscreen_monitors[0] = 0;
1639- c->fullscreen_monitors[1] = 0;
1640- c->fullscreen_monitors[2] = 0;
1641- c->fullscreen_monitors[3] = 0;
1642-
1643- /* Opacity for compositing manager */
1644- c->opacity = NET_WM_OPAQUE;
1645- getOpacity (display_info, c->window, &c->opacity);
1646- c->opacity_applied = c->opacity;
1647- c->opacity_flags = 0;
1648-
1649- /* Keep count of blinking iterations */
1650- c->blink_iterations = 0;
1651-
1652- if (getOpacityLock (display_info, c->window))
1653- {
1654- FLAG_SET (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED);
1655- }
1656-
1657- /* Timout for asynchronous icon update */
1658- c->icon_timeout_id = 0;
1659- /* Timout for asynchronous frame update */
1660- c->frame_timeout_id = 0;
1661- /* Timeout for blinking on urgency */
1662- c->blink_timeout_id = 0;
1663- /* Ping timeout */
1664- c->ping_timeout_id = 0;
1665- /* Ping timeout */
1666- c->ping_time = 0;
1667-
1668- c->class.res_name = NULL;
1669- c->class.res_class = NULL;
1670- XGetClassHint (display_info->dpy, w, &c->class);
1671- c->wmhints = XGetWMHints (display_info->dpy, c->window);
1672- c->group_leader = None;
1673- if (c->wmhints)
1674- {
1675- if (c->wmhints->flags & WindowGroupHint)
1676- {
1677- c->group_leader = c->wmhints->window_group;
1678- }
1679- }
1680- c->client_leader = getClientLeader (display_info, c->window);
1681-
1682- TRACE ("\"%s\" (0x%lx) initial map_state = %s",
1683- c->name, c->window,
1684- (attr.map_state == IsUnmapped) ?
1685- "IsUnmapped" :
1686- (attr.map_state == IsViewable) ?
1687- "IsViewable" :
1688- (attr.map_state == IsUnviewable) ?
1689- "IsUnviewable" :
1690- "(unknown)");
1691- if (attr.map_state != IsUnmapped)
1692- {
1693- /* Reparent will send us unmap/map events */
1694- FLAG_SET (c->xfwm_flags, XFWM_FLAG_MAP_PENDING);
1695- }
1696- c->ignore_unmap = 0;
1697- c->type = UNSET;
1698- c->type_atom = None;
1699-
1700- FLAG_SET (c->flags, START_ICONIC (c) ? CLIENT_FLAG_ICONIFIED : 0);
1701- FLAG_SET (c->wm_flags, HINTS_ACCEPT_INPUT (c->wmhints) ? WM_FLAG_INPUT : 0);
1702-
1703- clientGetWMProtocols (c);
1704- clientGetMWMHints (c, FALSE);
1705- c->win_layer = WIN_LAYER_NORMAL;
1706- c->fullscreen_old_layer = c->win_layer;
1707-
1708- /* net_wm_user_time standard */
1709- c->user_time = 0;
1710- c->user_time_win = getNetWMUserTimeWindow(display_info, c->window);
1711- clientAddUserTimeWin (c);
1712- clientGetUserTime (c);
1713-
1714- /*client PID */
1715- getHint (display_info, c->window, NET_WM_PID, (long *) &pid);
1716- c->pid = (GPid) pid;
1717- TRACE ("Client \"%s\" (0x%lx) PID = %i", c->name, c->window, c->pid);
1718-
1719- /* Apply startup notification properties if available */
1720- sn_client_startup_properties (c);
1721-
1722- /* Reload from session */
1723- if (sessionMatchWinToSM (c))
1724- {
1725- FLAG_SET (c->xfwm_flags, XFWM_FLAG_SESSION_MANAGED);
1726- }
1727-
1728- /* Beware, order of calls is important here ! */
1729- clientGetNetState (c);
1730- clientGetNetWmType (c);
1731- clientGetInitialNetWmDesktop (c);
1732- /* workarea will be updated when shown, no need to worry here */
1733- clientGetNetStruts (c);
1734-
1735- /* Once we know the type of window, we can initialize window position */
1736- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SESSION_MANAGED))
1737- {
1738- clientCoordGravitate (c, c->gravity, APPLY, &c->x, &c->y);
1739- if ((attr.map_state == IsUnmapped))
1740- {
1741- clientInitPosition (c);
1742- }
1743- }
1744-
1745- /*
1746- Initialize "old" fields once the position is ensured, to avoid
1747- initially maximized or fullscreen windows being placed offscreen
1748- once de-maximized
1749- */
1750- c->old_x = c->x;
1751- c->old_y = c->y;
1752- c->old_width = c->width;
1753- c->old_height = c->height;
1754-
1755- c->fullscreen_old_x = c->x;
1756- c->fullscreen_old_y = c->y;
1757- c->fullscreen_old_width = c->width;
1758- c->fullscreen_old_height = c->height;
1759-
1760- /*
1761- We must call clientApplyInitialState() after having placed the
1762- window so that the inital position values are correctly set if the
1763- inital state is maximize or fullscreen
1764- */
1765- clientApplyInitialState (c);
1766-
1767- valuemask = CWEventMask|CWBitGravity|CWWinGravity;
1768- attributes.event_mask = (FRAME_EVENT_MASK | POINTER_EVENT_MASK);
1769- attributes.win_gravity = StaticGravity;
1770- attributes.bit_gravity = StaticGravity;
1771-
1772-#ifdef HAVE_RENDER
1773- if ((attr.depth == 32) && (display_info->have_render))
1774- {
1775- c->visual = attr.visual;
1776- c->depth = attr.depth;
1777-
1778- attributes.colormap = attr.colormap;
1779- attributes.background_pixmap = None;
1780- attributes.border_pixel = 0;
1781- attributes.background_pixel = 0;
1782-
1783- valuemask |= CWColormap|CWBackPixmap|CWBackPixel|CWBorderPixel;
1784- }
1785- else
1786- {
1787- /* Default depth/visual */
1788- c->visual = screen_info->visual;
1789- c->depth = screen_info->depth;
1790- }
1791-#else /* HAVE_RENDER */
1792- /* We don't support multiple depth/visual w/out render */
1793- c->visual = screen_info->visual;
1794- c->depth = screen_info->depth;
1795-#endif /* HAVE_RENDER */
1796-
1797- c->frame =
1798- XCreateWindow (display_info->dpy, screen_info->xroot, 0, 0, 1, 1, 0,
1799- c->depth, InputOutput, c->visual, valuemask, &attributes);
1800-
1801- XSelectInput (display_info->dpy, c->window, NoEventMask);
1802- XSetWindowBorderWidth (display_info->dpy, c->window, 0);
1803- if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
1804- {
1805- XUnmapWindow (display_info->dpy, c->window);
1806- }
1807- XReparentWindow (display_info->dpy, c->window, c->frame, frameLeft (c), frameTop (c));
1808- valuemask = CWEventMask;
1809- attributes.event_mask = (CLIENT_EVENT_MASK);
1810- XChangeWindowAttributes (display_info->dpy, c->window, valuemask, &attributes);
1811- if (display_info->have_shape)
1812- {
1813- XShapeSelectInput (display_info->dpy, c->window, ShapeNotifyMask);
1814- }
1815-
1816- clientAddToList (c);
1817- clientGrabButtons(c);
1818-
1819- /* Initialize per client menu button pixmap */
1820-
1821- for (i = 0; i < STATE_TOGGLED; i++)
1822- {
1823- xfwmPixmapInit (screen_info, &c->appmenu[i]);
1824- }
1825-
1826- for (i = 0; i < SIDE_TOP; i++) /* Keep SIDE_TOP for later */
1827- {
1828- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
1829- &c->sides[i], NoEventMask,
1830- myDisplayGetCursorResize(screen_info->display_info, CORNER_COUNT + i));
1831- }
1832-
1833- for (i = 0; i < CORNER_COUNT; i++)
1834- {
1835- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
1836- &c->corners[i], NoEventMask,
1837- myDisplayGetCursorResize(screen_info->display_info, i));
1838- }
1839-
1840- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
1841- &c->title, NoEventMask, None);
1842-
1843- /*create the top side window AFTER the title window since they overlap
1844- and the top side window should be on top */
1845-
1846- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
1847- &c->sides[SIDE_TOP], NoEventMask,
1848- myDisplayGetCursorResize(screen_info->display_info,
1849- CORNER_COUNT + SIDE_TOP));
1850-
1851- for (i = 0; i < BUTTON_COUNT; i++)
1852- {
1853- xfwmWindowCreate (screen_info, c->visual, c->depth, c->frame,
1854- &c->buttons[i], BUTTON_EVENT_MASK, None);
1855- }
1856- clientUpdateIconPix (c);
1857-
1858- /* Put the window on top to avoid XShape, that speeds up hw accelerated
1859- GL apps dramatically */
1860- XRaiseWindow (display_info->dpy, c->window);
1861-
1862- TRACE ("now calling configure for the new window \"%s\" (0x%lx)", c->name, c->window);
1863- wc.x = c->x;
1864- wc.y = c->y;
1865- wc.width = c->width;
1866- wc.height = c->height;
1867- clientConfigure (c, &wc, CWX | CWY | CWHeight | CWWidth, CFG_NOTIFY | CFG_FORCE_REDRAW);
1868-
1869- /* Notify the compositor about this new window */
1870- compositorAddWindow (display_info, c->frame, c);
1871-
1872- if (!FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED))
1873- {
1874- if ((c->win_workspace == screen_info->current_ws) ||
1875- FLAG_TEST(c->flags, CLIENT_FLAG_STICKY))
1876- {
1877- if (recapture)
1878- {
1879- clientRaise (c, None);
1880- clientShow (c, TRUE);
1881- clientSortRing(c);
1882- }
1883- else
1884- {
1885- clientFocusNew(c);
1886- }
1887- }
1888- else
1889- {
1890- clientRaise (c, None);
1891- clientInitFocusFlag (c);
1892- clientSetNetActions (c);
1893- }
1894- }
1895- else
1896- {
1897- clientRaise (c, None);
1898- setWMState (display_info, c->window, IconicState);
1899- clientSetNetActions (c);
1900- }
1901- clientUpdateOpacity (c);
1902- clientGrabMouseButton (c);
1903- setNetFrameExtents (display_info, c->window, frameTop (c), frameLeft (c),
1904- frameRight (c), frameBottom (c));
1905- clientSetNetState (c);
1906-
1907- /* Window is reparented now, so we can safely release the grab
1908- * on the server
1909- */
1910- myDisplayUngrabServer (display_info);
1911- gdk_error_trap_pop ();
1912-
1913- DBG ("client \"%s\" (0x%lx) is now managed", c->name, c->window);
1914- DBG ("client_count=%d", screen_info->client_count);
1915-
1916- return c;
1917-}
1918-
1919-void
1920-clientUnframe (Client *c, gboolean remap)
1921-{
1922- ScreenInfo *screen_info;
1923- DisplayInfo *display_info;
1924- XEvent ev;
1925- int i;
1926- gboolean reparented;
1927-
1928- TRACE ("entering clientUnframe");
1929- TRACE ("unframing client \"%s\" (0x%lx) [%s]",
1930- c->name, c->window, remap ? "remap" : "no remap");
1931-
1932- g_return_if_fail (c != NULL);
1933-
1934- screen_info = c->screen_info;
1935- display_info = screen_info->display_info;
1936-
1937- clientRemoveFromList (c);
1938- compositorSetClient (display_info, c->frame, NULL);
1939-
1940- myDisplayGrabServer (display_info);
1941- gdk_error_trap_push ();
1942- clientRemoveUserTimeWin (c);
1943- clientUngrabButtons (c);
1944- XUnmapWindow (display_info->dpy, c->frame);
1945- clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y);
1946- XSelectInput (display_info->dpy, c->window, NoEventMask);
1947- XChangeSaveSet(display_info->dpy, c->window, SetModeDelete);
1948-
1949- reparented = XCheckTypedWindowEvent (display_info->dpy, c->window, ReparentNotify, &ev);
1950-
1951- if (remap || !reparented)
1952- {
1953- XReparentWindow (display_info->dpy, c->window, c->screen_info->xroot, c->x, c->y);
1954- XSetWindowBorderWidth (display_info->dpy, c->window, c->border_width);
1955- if (remap)
1956- {
1957- compositorAddWindow (display_info, c->window, NULL);
1958- XMapWindow (display_info->dpy, c->window);
1959- }
1960- else
1961- {
1962- XUnmapWindow (display_info->dpy, c->window);
1963- setWMState (display_info, c->window, WithdrawnState);
1964- }
1965- }
1966-
1967- if (!remap)
1968- {
1969- XDeleteProperty (display_info->dpy, c->window,
1970- display_info->atoms[NET_WM_STATE]);
1971- XDeleteProperty (display_info->dpy, c->window,
1972- display_info->atoms[NET_WM_DESKTOP]);
1973- XDeleteProperty (display_info->dpy, c->window,
1974- display_info->atoms[NET_WM_ALLOWED_ACTIONS]);
1975- }
1976-
1977- xfwmWindowDelete (&c->title);
1978-
1979- for (i = 0; i < SIDE_COUNT; i++)
1980- {
1981- xfwmWindowDelete (&c->sides[i]);
1982- }
1983- for (i = 0; i < CORNER_COUNT; i++)
1984- {
1985- xfwmWindowDelete (&c->corners[i]);
1986- }
1987- for (i = 0; i < STATE_TOGGLED; i++)
1988- {
1989- xfwmPixmapFree (&c->appmenu[i]);
1990- }
1991- for (i = 0; i < BUTTON_COUNT; i++)
1992- {
1993- xfwmWindowDelete (&c->buttons[i]);
1994- }
1995- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT))
1996- {
1997- workspaceUpdateArea (c->screen_info);
1998- }
1999- XDestroyWindow (display_info->dpy, c->frame);
2000-
2001- myDisplayUngrabServer (display_info);
2002- gdk_error_trap_pop ();
2003- clientFree (c);
2004-}
2005-
2006-void
2007-clientFrameAll (ScreenInfo *screen_info)
2008-{
2009- DisplayInfo *display_info;
2010- XWindowAttributes attr;
2011- xfwmWindow shield;
2012- Window w1, w2, *wins;
2013- unsigned int count, i;
2014-
2015- TRACE ("entering clientFrameAll");
2016-
2017- display_info = screen_info->display_info;
2018- clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), NO_FOCUS_FLAG);
2019- xfwmWindowTemp (screen_info,
2020- NULL, 0,
2021- screen_info->xroot,
2022- &shield,
2023- 0, 0,
2024- screen_info->width,
2025- screen_info->height,
2026- EnterWindowMask,
2027- FALSE);
2028-
2029- XSync (display_info->dpy, FALSE);
2030- myDisplayGrabServer (display_info);
2031- XQueryTree (display_info->dpy, screen_info->xroot, &w1, &w2, &wins, &count);
2032- for (i = 0; i < count; i++)
2033- {
2034- XGetWindowAttributes (display_info->dpy, wins[i], &attr);
2035- if ((attr.map_state == IsViewable) && (attr.root == screen_info->xroot))
2036- {
2037- Client *c = clientFrame (display_info, wins[i], TRUE);
2038- if ((c) && ((screen_info->params->raise_on_click) || (screen_info->params->click_to_focus)))
2039- {
2040- clientGrabMouseButton (c);
2041- }
2042- }
2043- else
2044- {
2045- compositorAddWindow (display_info, wins[i], NULL);
2046- }
2047- }
2048- if (wins)
2049- {
2050- XFree (wins);
2051- }
2052- clientFocusTop (screen_info, WIN_LAYER_FULLSCREEN, myDisplayGetCurrentTime (display_info));
2053- xfwmWindowDelete (&shield);
2054- myDisplayUngrabServer (display_info);
2055- XSync (display_info->dpy, FALSE);
2056-}
2057-
2058-void
2059-clientUnframeAll (ScreenInfo *screen_info)
2060-{
2061- DisplayInfo *display_info;
2062- Client *c;
2063- Window w1, w2, *wins;
2064- unsigned int count, i;
2065-
2066- TRACE ("entering clientUnframeAll");
2067-
2068- display_info = screen_info->display_info;
2069- clientSetFocus (screen_info, NULL, myDisplayGetCurrentTime (display_info), FOCUS_IGNORE_MODAL);
2070- XSync (display_info->dpy, FALSE);
2071- myDisplayGrabServer (display_info);
2072- XQueryTree (display_info->dpy, screen_info->xroot, &w1, &w2, &wins, &count);
2073- for (i = 0; i < count; i++)
2074- {
2075- c = myScreenGetClientFromWindow (screen_info, wins[i], SEARCH_FRAME);
2076- if (c)
2077- {
2078- clientUnframe (c, TRUE);
2079- }
2080- }
2081- myDisplayUngrabServer (display_info);
2082- XSync(display_info->dpy, FALSE);
2083- if (wins)
2084- {
2085- XFree (wins);
2086- }
2087-}
2088-
2089-Client *
2090-clientGetFromWindow (Client *c, Window w, unsigned short mode)
2091-{
2092- int b;
2093-
2094- g_return_val_if_fail (w != None, NULL);
2095- g_return_val_if_fail (c != NULL, NULL);
2096- TRACE ("entering clientGetFromWindow");
2097-
2098- if (mode & SEARCH_WINDOW)
2099- {
2100- if (c->window == w)
2101- {
2102- TRACE ("found \"%s\" (mode WINDOW)", c->name);
2103- return (c);
2104- }
2105- }
2106-
2107- if (mode & SEARCH_FRAME)
2108- {
2109- if (c->frame == w)
2110- {
2111- TRACE ("found \"%s\" (mode FRAME)", c->name);
2112- return (c);
2113- }
2114- }
2115-
2116- if (mode & SEARCH_WIN_USER_TIME)
2117- {
2118- if (c->user_time_win == w)
2119- {
2120- TRACE ("found \"%s\" (mode WIN_USER_TIME)", c->name);
2121- return (c);
2122- }
2123- }
2124-
2125- if (mode & SEARCH_BUTTON)
2126- {
2127- for (b = 0; b < BUTTON_COUNT; b++)
2128- {
2129- if (MYWINDOW_XWINDOW(c->buttons[b]) == w)
2130- {
2131- TRACE ("found \"%s\" (mode BUTTON)", c->name);
2132- return (c);
2133- }
2134- }
2135- }
2136-
2137- TRACE ("no client found");
2138-
2139- return NULL;
2140-}
2141-
2142-static void
2143-clientSetWorkspaceSingle (Client *c, guint ws)
2144-{
2145- ScreenInfo *screen_info;
2146- DisplayInfo *display_info;
2147-
2148- g_return_if_fail (c != NULL);
2149-
2150- TRACE ("entering clientSetWorkspaceSingle");
2151-
2152- screen_info = c->screen_info;
2153- display_info = screen_info->display_info;
2154-
2155- if (ws > screen_info->workspace_count - 1)
2156- {
2157- ws = screen_info->workspace_count - 1;
2158- TRACE ("value off limits, using %i instead", ws);
2159- }
2160-
2161- if (c->win_workspace != ws)
2162- {
2163- TRACE ("setting client \"%s\" (0x%lx) to current_ws %d", c->name, c->window, ws);
2164- c->win_workspace = ws;
2165- if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
2166- {
2167- setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES);
2168- }
2169- else
2170- {
2171- setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ws);
2172- }
2173- }
2174- FLAG_SET (c->xfwm_flags, XFWM_FLAG_WORKSPACE_SET);
2175-}
2176-
2177-void
2178-clientSetWorkspace (Client *c, guint ws, gboolean manage_mapping)
2179-{
2180- Client *c2;
2181- GList *list_of_windows;
2182- GList *list;
2183- guint previous_ws;
2184-
2185- g_return_if_fail (c != NULL);
2186-
2187- TRACE ("entering clientSetWorkspace");
2188-
2189- if (ws > c->screen_info->workspace_count - 1)
2190- {
2191- g_warning ("Requested workspace %d does not exist", ws);
2192- return;
2193- }
2194-
2195- list_of_windows = clientListTransientOrModal (c);
2196- for (list = list_of_windows; list; list = g_list_next (list))
2197- {
2198- c2 = (Client *) list->data;
2199-
2200- if (c2->win_workspace != ws)
2201- {
2202- TRACE ("setting client \"%s\" (0x%lx) to current_ws %d", c->name, c->window, ws);
2203-
2204- previous_ws = c2->win_workspace;
2205- clientSetWorkspaceSingle (c2, ws);
2206-
2207- if (manage_mapping && !FLAG_TEST (c2->flags, CLIENT_FLAG_ICONIFIED))
2208- {
2209- if (previous_ws == c2->screen_info->current_ws)
2210- {
2211- clientWithdraw (c2, c2->screen_info->current_ws, FALSE);
2212- }
2213- if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY) || (ws == c2->screen_info->current_ws))
2214- {
2215- clientShow (c2, FALSE);
2216- }
2217- }
2218- }
2219- }
2220- g_list_free (list_of_windows);
2221-}
2222-
2223-static void
2224-clientShowSingle (Client *c, gboolean deiconify)
2225-{
2226- ScreenInfo *screen_info;
2227- DisplayInfo *display_info;
2228-
2229- g_return_if_fail (c != NULL);
2230-
2231- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
2232- {
2233- /* Should we map the window if it is visible? */
2234- return;
2235- }
2236-
2237- screen_info = c->screen_info;
2238- display_info = screen_info->display_info;
2239-
2240- if ((c->win_workspace == screen_info->current_ws) || FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
2241- {
2242- TRACE ("showing client \"%s\" (0x%lx)", c->name, c->window);
2243- FLAG_SET (c->xfwm_flags, XFWM_FLAG_VISIBLE);
2244- XMapWindow (display_info->dpy, c->frame);
2245- if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
2246- {
2247- XMapWindow (display_info->dpy, c->window);
2248- }
2249- /* Adjust to urgency state as the window is visible */
2250- clientUpdateUrgency (c);
2251- }
2252- if (deiconify)
2253- {
2254- FLAG_UNSET (c->flags, CLIENT_FLAG_ICONIFIED);
2255- setWMState (display_info, c->window, NormalState);
2256- }
2257- clientSetNetActions (c);
2258- clientSetNetState (c);
2259-}
2260-
2261-void
2262-clientShow (Client *c, gboolean deiconify)
2263-{
2264- Client *c2;
2265- GList *list_of_windows;
2266- GList *list;
2267-
2268- g_return_if_fail (c != NULL);
2269- TRACE ("entering clientShow \"%s\" (0x%lx)", c->name, c->window);
2270-
2271- list_of_windows = clientListTransientOrModal (c);
2272- for (list = g_list_last (list_of_windows); list; list = g_list_previous (list))
2273- {
2274- c2 = (Client *) list->data;
2275- clientSetWorkspaceSingle (c2, c->win_workspace);
2276- /* Ignore request before if the window is not yet managed */
2277- if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED))
2278- {
2279- continue;
2280- }
2281- clientShowSingle (c2, deiconify);
2282- }
2283- g_list_free (list_of_windows);
2284-
2285- /* Update working area as windows have been shown */
2286- workspaceUpdateArea (c->screen_info);
2287-}
2288-
2289-static void
2290-clientWithdrawSingle (Client *c, GList *exclude_list, gboolean iconify)
2291-{
2292- ScreenInfo *screen_info;
2293- DisplayInfo *display_info;
2294-
2295- g_return_if_fail (c != NULL);
2296-
2297- screen_info = c->screen_info;
2298- display_info = screen_info->display_info;
2299-
2300- TRACE ("hiding client \"%s\" (0x%lx)", c->name, c->window);
2301- clientPassFocus(c->screen_info, c, exclude_list);
2302- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
2303- {
2304- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_VISIBLE);
2305- c->ignore_unmap++;
2306- /* Adjust to urgency state as the window is not visible */
2307- clientUpdateUrgency (c);
2308- }
2309- XUnmapWindow (display_info->dpy, c->window);
2310- XUnmapWindow (display_info->dpy, c->frame);
2311- if (iconify)
2312- {
2313- FLAG_SET (c->flags, CLIENT_FLAG_ICONIFIED);
2314- setWMState (display_info, c->window, IconicState);
2315- if (!screen_info->show_desktop)
2316- {
2317- clientSetLast (c);
2318- }
2319- }
2320- clientSetNetActions (c);
2321- clientSetNetState (c);
2322-}
2323-
2324-void
2325-clientWithdraw (Client *c, guint ws, gboolean iconify)
2326-{
2327- Client *c2;
2328- GList *list_of_windows;
2329- GList *list;
2330-
2331- g_return_if_fail (c != NULL);
2332- TRACE ("entering clientWithdraw \"%s\" (0x%lx)", c->name, c->window);
2333-
2334- list_of_windows = clientListTransientOrModal (c);
2335- for (list = list_of_windows; list; list = g_list_next (list))
2336- {
2337- c2 = (Client *) list->data;
2338-
2339- /* Ignore request before if the window is not yet managed */
2340- if (!FLAG_TEST (c2->xfwm_flags, XFWM_FLAG_MANAGED))
2341- {
2342- continue;
2343- }
2344-
2345- if (FLAG_TEST (c2->flags, CLIENT_FLAG_STICKY) && !iconify)
2346- {
2347- continue;
2348- }
2349-
2350- if (clientIsTransientOrModalForGroup (c2))
2351- {
2352-
2353- if (clientTransientOrModalHasAncestor (c2, c2->win_workspace))
2354- {
2355- /* Other ancestors for that transient for group are still
2356- * visible on current workspace, so don't hide it...
2357- */
2358- continue;
2359- }
2360- if ((ws != c2->win_workspace) &&
2361- clientTransientOrModalHasAncestor (c2, ws))
2362- {
2363- /* ws is used when transitioning between desktops, to avoid
2364- hiding a transient for group that will be shown again on the new
2365- workspace (transient for groups can be transients for multiple
2366- ancesors splitted across workspaces...)
2367- */
2368- continue;
2369- }
2370- }
2371- clientWithdrawSingle (c2, list_of_windows, iconify);
2372- }
2373- g_list_free (list_of_windows);
2374-
2375- /* Update working area as windows have been hidden */
2376- workspaceUpdateArea (c->screen_info);
2377-}
2378-
2379-void
2380-clientWithdrawAll (Client *c, guint ws)
2381-{
2382- GList *list;
2383- Client *c2;
2384- ScreenInfo *screen_info;
2385-
2386- g_return_if_fail (c != NULL);
2387-
2388- TRACE ("entering clientWithdrawAll");
2389-
2390- screen_info = c->screen_info;
2391- for (list = screen_info->windows_stack; list; list = g_list_next (list))
2392- {
2393- c2 = (Client *) list->data;
2394-
2395- if ((c2 != c)
2396- && CLIENT_CAN_HIDE_WINDOW (c2)
2397- && !clientIsTransientOrModal (c2))
2398- {
2399- if (((!c) && (c2->win_workspace == ws))
2400- || ((c) && !clientIsTransientOrModalFor (c, c2)
2401- && (c2->win_workspace == c->win_workspace)))
2402- {
2403- clientWithdraw (c2, ws, TRUE);
2404- }
2405- }
2406- }
2407-}
2408-
2409-void
2410-clientClearAllShowDesktop (ScreenInfo *screen_info)
2411-{
2412- GList *list;
2413-
2414- TRACE ("entering clientClearShowDesktop");
2415-
2416- if (screen_info->show_desktop)
2417- {
2418- for (list = screen_info->windows_stack; list; list = g_list_next (list))
2419- {
2420- Client *c = (Client *) list->data;
2421- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN);
2422- }
2423- screen_info->show_desktop = FALSE;
2424- sendRootMessage (screen_info, NET_SHOWING_DESKTOP, screen_info->show_desktop,
2425- myDisplayGetCurrentTime (screen_info->display_info));
2426- }
2427-}
2428-
2429-void
2430-clientToggleShowDesktop (ScreenInfo *screen_info)
2431-{
2432- GList *list;
2433-
2434- TRACE ("entering clientToggleShowDesktop");
2435-
2436- clientSetFocus (screen_info, NULL,
2437- myDisplayGetCurrentTime (screen_info->display_info),
2438- FOCUS_IGNORE_MODAL);
2439- if (screen_info->show_desktop)
2440- {
2441- for (list = screen_info->windows_stack; list; list = g_list_next (list))
2442- {
2443- Client *c = (Client *) list->data;
2444- if ((c->type & WINDOW_REGULAR_FOCUSABLE)
2445- && !FLAG_TEST (c->flags, CLIENT_FLAG_ICONIFIED | CLIENT_FLAG_SKIP_TASKBAR))
2446- {
2447- FLAG_SET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN);
2448- clientWithdraw (c, c->win_workspace, TRUE);
2449- }
2450- }
2451- clientFocusTop (screen_info, WIN_LAYER_DESKTOP, myDisplayGetCurrentTime (screen_info->display_info));
2452- }
2453- else
2454- {
2455- for (list = g_list_last(screen_info->windows_stack); list; list = g_list_previous (list))
2456- {
2457- Client *c = (Client *) list->data;
2458- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN))
2459- {
2460- clientShow (c, TRUE);
2461- }
2462- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN);
2463- }
2464- clientFocusTop (screen_info, WIN_LAYER_FULLSCREEN, myDisplayGetCurrentTime (screen_info->display_info));
2465- }
2466-}
2467-
2468-void
2469-clientActivate (Client *c, guint32 timestamp, gboolean source_is_application)
2470-{
2471- ScreenInfo *screen_info;
2472- Client *focused;
2473- Client *sibling;
2474-
2475- g_return_if_fail (c != NULL);
2476- TRACE ("entering clientActivate \"%s\" (0x%lx)", c->name, c->window);
2477-
2478- screen_info = c->screen_info;
2479- sibling = clientGetTransientFor(c);
2480- focused = clientGetFocus ();
2481-
2482- if ((screen_info->current_ws == c->win_workspace) || (screen_info->params->activate_action != ACTIVATE_ACTION_NONE))
2483- {
2484- if ((focused) && (c != focused))
2485- {
2486- /* We might be able to avoid this if we are about to switch workspace */
2487- clientAdjustFullscreenLayer (focused, FALSE);
2488- }
2489- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_WAS_SHOWN))
2490- {
2491- /* We are explicitely activating a window that was shown before show-desktop */
2492- clientClearAllShowDesktop (screen_info);
2493- }
2494- if (screen_info->current_ws != c->win_workspace)
2495- {
2496- if (screen_info->params->activate_action == ACTIVATE_ACTION_BRING)
2497- {
2498- clientSetWorkspace (c, screen_info->current_ws, TRUE);
2499- }
2500- else
2501- {
2502- workspaceSwitch (screen_info, c->win_workspace, NULL, FALSE, timestamp);
2503- }
2504- }
2505- clientRaise (sibling, None);
2506- clientShow (sibling, TRUE);
2507- if (source_is_application || screen_info->params->click_to_focus || (c->type & WINDOW_TYPE_DONT_FOCUS))
2508- {
2509- /*
2510- It's a bit tricky here, we want to honor the activate request only if:
2511-
2512- - The window use the _NET_ACTIVE_WINDOW protocol and identify itself as an application,
2513- - Or we use the click to focus model, in that case we focus the raised window anyway,
2514- - Or the request comes from an application that we would not focus by default,
2515- such as panels for example
2516- */
2517- clientSetFocus (screen_info, c, timestamp, NO_FOCUS_FLAG);
2518- }
2519- clientSetLastRaise (c);
2520- }
2521- else
2522- {
2523- TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
2524- FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
2525- clientSetNetState (c);
2526- }
2527-}
2528-
2529-void
2530-clientClose (Client *c)
2531-{
2532- ScreenInfo *screen_info;
2533- DisplayInfo *display_info;
2534- guint32 timestamp;
2535-
2536- g_return_if_fail (c != NULL);
2537-
2538- TRACE ("entering clientClose");
2539- TRACE ("closing client \"%s\" (0x%lx)", c->name, c->window);
2540-
2541- screen_info = c->screen_info;
2542- display_info = screen_info->display_info;
2543- timestamp = myDisplayGetCurrentTime (display_info);
2544- timestamp = myDisplayGetTime (display_info, timestamp);
2545-
2546- if (FLAG_TEST (c->wm_flags, WM_FLAG_DELETE))
2547- {
2548- sendClientMessage (screen_info, c->window, WM_DELETE_WINDOW, timestamp);
2549- }
2550- else
2551- {
2552- clientKill (c);
2553- }
2554- if (FLAG_TEST (c->wm_flags, WM_FLAG_PING))
2555- {
2556- clientSendNetWMPing (c, timestamp);
2557- }
2558-}
2559-
2560-void
2561-clientKill (Client *c)
2562-{
2563- g_return_if_fail (c != NULL);
2564- TRACE ("entering clientKill");
2565- TRACE ("killing client \"%s\" (0x%lx)", c->name, c->window);
2566-
2567- XKillClient (clientGetXDisplay (c), c->window);
2568-}
2569-
2570-void
2571-clientTerminate (Client *c)
2572-{
2573- ScreenInfo *screen_info;
2574- DisplayInfo *display_info;
2575-
2576- g_return_if_fail (c != NULL);
2577- TRACE ("entering clientTerminate");
2578-
2579- screen_info = c->screen_info;
2580- display_info = screen_info->display_info;
2581-
2582- if ((c->hostname) && (c->pid > 0))
2583- {
2584- if (!strcmp (display_info->hostname, c->hostname))
2585- {
2586- TRACE ("Sending client %s (pid %i) signal SIGKILL\n", c->name, c->pid);
2587-
2588- if (kill (c->pid, SIGKILL) < 0)
2589- {
2590- g_warning ("Failed to kill client id %d: %s", c->pid, strerror (errno));
2591- }
2592- }
2593- }
2594-
2595- clientKill (c);
2596-}
2597-
2598-void
2599-clientEnterContextMenuState (Client *c)
2600-{
2601- ScreenInfo *screen_info;
2602- DisplayInfo *display_info;
2603-
2604- g_return_if_fail (c != NULL);
2605-
2606- TRACE ("entering clientEnterContextMenuState");
2607- TRACE ("Showing the what's this help for client \"%s\" (0x%lx)", c->name, c->window);
2608-
2609- screen_info = c->screen_info;
2610- display_info = screen_info->display_info;
2611-
2612- if (FLAG_TEST (c->wm_flags, WM_FLAG_CONTEXT_HELP))
2613- {
2614- sendClientMessage (c->screen_info, c->window, NET_WM_CONTEXT_HELP,
2615- myDisplayGetCurrentTime (display_info));
2616- }
2617-}
2618-
2619-void
2620-clientSetLayer (Client *c, guint l)
2621-{
2622- GList *list_of_windows = NULL;
2623- GList *list = NULL;
2624- Client *c2 = NULL;
2625-
2626- g_return_if_fail (c != NULL);
2627- TRACE ("entering clientSetLayer for \"%s\" (0x%lx) on layer %d", c->name, c->window, l);
2628-
2629- list_of_windows = clientListTransientOrModal (c);
2630- for (list = list_of_windows; list; list = g_list_next (list))
2631- {
2632- c2 = (Client *) list->data;
2633- if (c2->win_layer != l)
2634- {
2635- TRACE ("setting client \"%s\" (0x%lx) layer to %d", c2->name,
2636- c2->window, l);
2637- c2->win_layer = l;
2638- }
2639- }
2640- g_list_free (list_of_windows);
2641-
2642- if (clientGetLastRaise (c->screen_info) == c)
2643- {
2644- clientClearLastRaise (c->screen_info);
2645- }
2646-
2647- c2 = clientGetFocusOrPending ();
2648- if (c2 && (c2 != c) && (c2->win_layer == c->win_layer))
2649- {
2650- TRACE ("Placing %s under %s", c->name, c2->name);
2651- clientLower (c, c2->frame);
2652- }
2653- else
2654- {
2655- TRACE ("Placing %s on top of its layer %lu", c->name, c->win_layer);
2656- clientRaise (c, None);
2657- }
2658-}
2659-
2660-void
2661-clientShade (Client *c)
2662-{
2663- XWindowChanges wc;
2664- ScreenInfo *screen_info;
2665- DisplayInfo *display_info;
2666- unsigned long mask;
2667-
2668- g_return_if_fail (c != NULL);
2669- TRACE ("entering clientToggleShaded");
2670- TRACE ("shading client \"%s\" (0x%lx)", c->name, c->window);
2671-
2672- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER)
2673- || FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
2674- {
2675- TRACE ("cowardly refusing to shade \"%s\" (0x%lx) because it has no border", c->name, c->window);
2676- return;
2677- }
2678- else if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
2679- {
2680- TRACE ("\"%s\" (0x%lx) is already shaded", c->name, c->window);
2681- return;
2682- }
2683-
2684- screen_info = c->screen_info;
2685- display_info = screen_info->display_info;
2686-
2687- FLAG_SET (c->flags, CLIENT_FLAG_SHADED);
2688- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
2689- {
2690- mask = (CWWidth | CWHeight);
2691- if (clientConstrainPos (c, FALSE))
2692- {
2693- wc.x = c->x;
2694- wc.y = c->y;
2695- mask |= (CWX | CWY);
2696- }
2697-
2698- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
2699- {
2700- c->ignore_unmap++;
2701- }
2702- /*
2703- * Shading unmaps the client window. We therefore have to transfer focus to its frame
2704- * so that focus doesn't return to root. clientSetFocus() will take care of focusing
2705- * the window frame since the SHADED flag is now set.
2706- */
2707- if (c == clientGetFocus ())
2708- {
2709- clientSetFocus (screen_info, c, myDisplayGetCurrentTime (display_info), FOCUS_FORCE);
2710- }
2711- XUnmapWindow (display_info->dpy, c->window);
2712-
2713- wc.width = c->width;
2714- wc.height = c->height;
2715- clientConfigure (c, &wc, mask, CFG_FORCE_REDRAW);
2716- }
2717- clientSetNetState (c);
2718-}
2719-
2720-void
2721-clientUnshade (Client *c)
2722-{
2723- XWindowChanges wc;
2724- ScreenInfo *screen_info;
2725- DisplayInfo *display_info;
2726-
2727- g_return_if_fail (c != NULL);
2728- TRACE ("entering clientToggleShaded");
2729- TRACE ("shading/unshading client \"%s\" (0x%lx)", c->name, c->window);
2730-
2731- if (!FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
2732- {
2733- TRACE ("\"%s\" (0x%lx) is not shaded", c->name, c->window);
2734- return;
2735- }
2736-
2737- screen_info = c->screen_info;
2738- display_info = screen_info->display_info;
2739-
2740- FLAG_UNSET (c->flags, CLIENT_FLAG_SHADED);
2741- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
2742- {
2743- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
2744- {
2745- XMapWindow (display_info->dpy, c->window);
2746- }
2747- /*
2748- * Unshading will show the client window, so we need to focus it when unshading.
2749- */
2750- if (c == clientGetFocus ())
2751- {
2752- clientSetFocus (screen_info, c, myDisplayGetCurrentTime (display_info), FOCUS_FORCE);
2753- }
2754-
2755- wc.width = c->width;
2756- wc.height = c->height;
2757- clientConfigure (c, &wc, CWWidth | CWHeight, CFG_FORCE_REDRAW);
2758- }
2759- clientSetNetState (c);
2760-}
2761-
2762-void
2763-clientToggleShaded (Client *c)
2764-{
2765- if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED))
2766- {
2767- clientUnshade (c);
2768- }
2769- else
2770- {
2771- clientShade (c);
2772- }
2773-}
2774-
2775-void
2776-clientStick (Client *c, gboolean include_transients)
2777-{
2778- ScreenInfo *screen_info;
2779- DisplayInfo *display_info;
2780- Client *c2;
2781- GList *list_of_windows;
2782- GList *list;
2783-
2784- g_return_if_fail (c != NULL);
2785- TRACE ("entering clientStick");
2786-
2787- screen_info = c->screen_info;
2788- display_info = screen_info->display_info;
2789-
2790- if (include_transients)
2791- {
2792- list_of_windows = clientListTransientOrModal (c);
2793- for (list = list_of_windows; list; list = g_list_next (list))
2794- {
2795- c2 = (Client *) list->data;
2796- TRACE ("Sticking client \"%s\" (0x%lx)", c2->name, c2->window);
2797- FLAG_SET (c2->flags, CLIENT_FLAG_STICKY);
2798- setHint (display_info, c2->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES);
2799- frameQueueDraw (c2, FALSE);
2800- }
2801- g_list_free (list_of_windows);
2802- }
2803- else
2804- {
2805- TRACE ("Sticking client \"%s\" (0x%lx)", c->name, c->window);
2806- FLAG_SET (c->flags, CLIENT_FLAG_STICKY);
2807- setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) ALL_WORKSPACES);
2808- }
2809- clientSetWorkspace (c, screen_info->current_ws, TRUE);
2810- clientSetNetState (c);
2811-}
2812-
2813-void
2814-clientUnstick (Client *c, gboolean include_transients)
2815-{
2816- ScreenInfo *screen_info;
2817- DisplayInfo *display_info;
2818- Client *c2;
2819- GList *list_of_windows;
2820- GList *list;
2821-
2822- g_return_if_fail (c != NULL);
2823- TRACE ("entering clientUnstick");
2824-
2825- screen_info = c->screen_info;
2826- display_info = screen_info->display_info;
2827-
2828- if (include_transients)
2829- {
2830- list_of_windows = clientListTransientOrModal (c);
2831- for (list = list_of_windows; list; list = g_list_next (list))
2832- {
2833- c2 = (Client *) list->data;
2834- TRACE ("Unsticking client \"%s\" (0x%lx)", c2->name, c2->window);
2835- FLAG_UNSET (c2->flags, CLIENT_FLAG_STICKY);
2836- setHint (display_info, c2->window, NET_WM_DESKTOP, (unsigned long) screen_info->current_ws);
2837- frameQueueDraw (c2, FALSE);
2838- }
2839- g_list_free (list_of_windows);
2840- }
2841- else
2842- {
2843- TRACE ("Unsticking client \"%s\" (0x%lx)", c->name, c->window);
2844- FLAG_UNSET (c->flags, CLIENT_FLAG_STICKY);
2845- setHint (display_info, c->window, NET_WM_DESKTOP, (unsigned long) screen_info->current_ws);
2846- }
2847- clientSetWorkspace (c, screen_info->current_ws, TRUE);
2848- clientSetNetState (c);
2849-}
2850-
2851-void
2852-clientToggleSticky (Client *c, gboolean include_transients)
2853-{
2854- g_return_if_fail (c != NULL);
2855- TRACE ("entering clientToggleSticky");
2856- TRACE ("sticking/unsticking client \"%s\" (0x%lx)", c->name, c->window);
2857-
2858- if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY))
2859- {
2860- clientUnstick (c, include_transients);
2861- }
2862- else
2863- {
2864- clientStick (c, include_transients);
2865- }
2866-}
2867-
2868-void
2869-clientUpdateFullscreenSize (Client *c)
2870-{
2871- ScreenInfo *screen_info;
2872- XWindowChanges wc;
2873- GdkRectangle monitor, rect;
2874- int i;
2875-
2876- g_return_if_fail (c != NULL);
2877- TRACE ("entering clientUpdateFullscreenSize");
2878- TRACE ("Update fullscreen size for client \"%s\" (0x%lx)", c->name, c->window);
2879-
2880- screen_info = c->screen_info;
2881-
2882- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
2883- {
2884- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS))
2885- {
2886- gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[0], &rect);
2887- for (i = 1; i < 4; i++)
2888- {
2889- gdk_screen_get_monitor_geometry (screen_info->gscr, c->fullscreen_monitors[i], &monitor);
2890- gdk_rectangle_union (&rect, &monitor, &rect);
2891- }
2892- }
2893- else
2894- {
2895- int cx, cy;
2896-
2897- cx = frameX (c) + (frameWidth (c) / 2);
2898- cy = frameY (c) + (frameHeight (c) / 2);
2899-
2900- myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect);
2901- }
2902-
2903- wc.x = rect.x;
2904- wc.y = rect.y;
2905- wc.width = rect.width;
2906- wc.height = rect.height;
2907- }
2908-
2909- else
2910- {
2911- wc.x = c->fullscreen_old_x;
2912- wc.y = c->fullscreen_old_y;
2913- wc.width = c->fullscreen_old_width;
2914- wc.height = c->fullscreen_old_height;
2915- }
2916-
2917- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
2918- {
2919- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW);
2920- }
2921- else
2922- {
2923- c->x = wc.x;
2924- c->y = wc.y;
2925- c->height = wc.height;
2926- c->width = wc.width;
2927- }
2928-}
2929-
2930-void clientToggleFullscreen (Client *c)
2931-{
2932- g_return_if_fail (c != NULL);
2933- TRACE ("entering clientToggleFullscreen");
2934- TRACE ("toggle fullscreen client \"%s\" (0x%lx)", c->name, c->window);
2935-
2936- /*can we switch to full screen, does it make any sense? */
2937- if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) && (c->size->flags & PMaxSize))
2938- {
2939- GdkRectangle rect;
2940- int cx, cy;
2941-
2942- cx = frameX (c) + (frameWidth (c) / 2);
2943- cy = frameY (c) + (frameHeight (c) / 2);
2944-
2945- myScreenFindMonitorAtPoint (c->screen_info, cx, cy, &rect);
2946-
2947- if ((c->size->max_width < rect.width) || (c->size->max_height < rect.height))
2948- {
2949- return;
2950- }
2951- }
2952-
2953- if (!clientIsTransientOrModal (c) && (c->type == WINDOW_NORMAL))
2954- {
2955- FLAG_TOGGLE (c->flags, CLIENT_FLAG_FULLSCREEN);
2956- clientUpdateFullscreenState (c);
2957- }
2958-}
2959-
2960-void clientSetFullscreenMonitor (Client *c, gint top, gint bottom, gint left, gint right)
2961-{
2962- ScreenInfo *screen_info;
2963- DisplayInfo *display_info;
2964- gint num_monitors;
2965-
2966- g_return_if_fail (c != NULL);
2967- TRACE ("entering clientSetFullscreenMonitor");
2968-
2969- screen_info = c->screen_info;
2970- display_info = screen_info->display_info;
2971-
2972- num_monitors = gdk_screen_get_n_monitors (screen_info->gscr);
2973- if ((top >= 0) && (top < num_monitors) &&
2974- (bottom >= 0) && (bottom < num_monitors) &&
2975- (left >= 0) && (left < num_monitors) &&
2976- (right >= 0) && (right < num_monitors))
2977- {
2978- c->fullscreen_monitors[0] = top;
2979- c->fullscreen_monitors[1] = bottom;
2980- c->fullscreen_monitors[2] = left;
2981- c->fullscreen_monitors[3] = right;
2982- FLAG_SET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS);
2983- }
2984- else
2985- {
2986- c->fullscreen_monitors[0] = 0;
2987- c->fullscreen_monitors[1] = 0;
2988- c->fullscreen_monitors[2] = 0;
2989- c->fullscreen_monitors[3] = 0;
2990- FLAG_UNSET (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS);
2991- }
2992- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
2993- {
2994- clientUpdateFullscreenSize (c);
2995- }
2996- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREN_MONITORS))
2997- {
2998- setNetFullscreenMonitors (display_info, c->window, top, bottom, left, right);
2999- }
3000-}
3001-
3002-void clientToggleLayerAbove (Client *c)
3003-{
3004- g_return_if_fail (c != NULL);
3005- TRACE ("entering clientToggleAbove");
3006-
3007- if ((c->type & WINDOW_REGULAR_FOCUSABLE) &&
3008- !clientIsTransientOrModal (c) &&
3009- !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
3010- {
3011- FLAG_UNSET (c->flags, CLIENT_FLAG_BELOW);
3012- FLAG_TOGGLE (c->flags, CLIENT_FLAG_ABOVE);
3013- clientUpdateLayerState (c);
3014- }
3015-}
3016-
3017-void clientToggleLayerBelow (Client *c)
3018-{
3019- g_return_if_fail (c != NULL);
3020- TRACE ("entering clientToggleBelow");
3021-
3022- if ((c->type & WINDOW_REGULAR_FOCUSABLE) &&
3023- !clientIsTransientOrModal (c) &&
3024- !FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
3025- {
3026- FLAG_UNSET (c->flags, CLIENT_FLAG_ABOVE);
3027- FLAG_TOGGLE (c->flags, CLIENT_FLAG_BELOW);
3028- clientUpdateLayerState (c);
3029- }
3030-}
3031-
3032-void clientSetLayerNormal (Client *c)
3033-{
3034- g_return_if_fail (c != NULL);
3035- TRACE ("entering clientSetLayerNormal");
3036-
3037- if (!FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
3038- {
3039- FLAG_UNSET (c->flags, CLIENT_FLAG_ABOVE | CLIENT_FLAG_BELOW);
3040- clientUpdateLayerState (c);
3041- }
3042-}
3043-
3044-void
3045-clientRemoveMaximizeFlag (Client *c)
3046-{
3047- g_return_if_fail (c != NULL);
3048- TRACE ("entering clientRemoveMaximizeFlag");
3049- TRACE ("Removing maximize flag on client \"%s\" (0x%lx)", c->name,
3050- c->window);
3051-
3052- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED);
3053- frameQueueDraw (c, FALSE);
3054- clientSetNetActions (c);
3055- clientSetNetState (c);
3056-}
3057-
3058-static void
3059-clientNewMaxState (Client *c, XWindowChanges *wc, int mode)
3060-{
3061- if (FLAG_TEST_ALL (mode, CLIENT_FLAG_MAXIMIZED))
3062- {
3063- /*
3064- * We need to test specifically for full de-maximization
3065- * otherwise it's too confusing when the window changes
3066- * from horiz to vertical maximization or vice-versa.
3067- */
3068- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
3069- {
3070- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED);
3071- wc->x = c->old_x;
3072- wc->y = c->old_y;
3073- wc->width = c->old_width;
3074- wc->height = c->old_height;
3075-
3076- return;
3077- }
3078- }
3079-
3080- if (FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED_HORIZ))
3081- {
3082- if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ))
3083- {
3084- FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ);
3085- }
3086- else
3087- {
3088- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ);
3089- wc->x = c->old_x;
3090- wc->y = c->old_y;
3091- wc->width = c->old_width;
3092- wc->height = c->old_height;
3093- }
3094- }
3095-
3096- if (FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED_VERT))
3097- {
3098- if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT))
3099- {
3100- FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT);
3101- }
3102- else
3103- {
3104- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT);
3105- wc->x = c->old_x;
3106- wc->y = c->old_y;
3107- wc->width = c->old_width;
3108- wc->height = c->old_height;
3109- }
3110- }
3111-}
3112-
3113-static gboolean
3114-clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *rect, tilePositionType tile)
3115-{
3116- ScreenInfo *screen_info;
3117- int full_x, full_y, full_w, full_h;
3118- int tmp_x, tmp_y, tmp_w, tmp_h;
3119-
3120- tmp_x = frameX (c);
3121- tmp_y = frameY (c);
3122- tmp_h = frameHeight (c);
3123- tmp_w = frameWidth (c);
3124- screen_info = c->screen_info;
3125-
3126- full_x = MAX (screen_info->params->xfwm_margins[STRUTS_LEFT], rect->x);
3127- full_y = MAX (screen_info->params->xfwm_margins[STRUTS_TOP], rect->y);
3128- full_w = MIN (screen_info->width - screen_info->params->xfwm_margins[STRUTS_RIGHT],
3129- rect->x + rect->width) - full_x;
3130- full_h = MIN (screen_info->height - screen_info->params->xfwm_margins[STRUTS_BOTTOM],
3131- rect->y + rect->height) - full_y;
3132-
3133- if (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED))
3134- {
3135- /* Adjust size to the largest size available, not covering struts */
3136- clientMaxSpace (screen_info, &full_x, &full_y, &full_w, &full_h);
3137- wc->x = full_x + frameLeft (c);
3138- wc->y = full_y + frameTop (c);
3139- wc->width = full_w - frameLeft (c) - frameRight (c);
3140- wc->height = full_h - frameTop (c) - frameBottom (c);
3141-
3142- return ((wc->width <= c->size->max_width) && (wc->height <= c->size->max_height));
3143- }
3144-
3145- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ))
3146- {
3147- /* Adjust size to the widest size available, for the current vertical position/height */
3148- switch (tile)
3149- {
3150- case TILE_UP:
3151- tmp_h = full_h / 2;
3152- tmp_y = full_y;
3153- clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h);
3154- wc->y = tmp_y + frameTop (c);
3155- wc->height = tmp_h - frameTop (c) - frameBottom (c);
3156- break;
3157- case TILE_DOWN:
3158- tmp_h = full_h / 2;
3159- tmp_y = full_y + full_h / 2;
3160- clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h);
3161- wc->y = tmp_y + frameTop (c);
3162- wc->height = tmp_h - frameTop (c) - frameBottom (c);
3163- break;
3164- default:
3165- clientMaxSpace (screen_info, &full_x, &tmp_y, &full_w, &tmp_h);
3166- break;
3167- }
3168-
3169- wc->x = full_x + frameLeft (c);
3170- wc->width = full_w - frameLeft (c) - frameRight (c);
3171-
3172- return (wc->width <= c->size->max_width);
3173- }
3174-
3175- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT))
3176- {
3177- /* Adjust size to the tallest size available, for the current horizontal position/width */
3178- switch (tile)
3179- {
3180- case TILE_LEFT:
3181- tmp_x = full_x;
3182- tmp_w = full_w / 2;
3183- clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h);
3184- wc->x = tmp_x + frameLeft (c);
3185- wc->width = tmp_w - frameLeft (c) - frameRight (c);
3186- break;
3187- case TILE_RIGHT:
3188- tmp_x = full_x + full_w /2;
3189- tmp_w = full_w / 2;
3190- clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h);
3191- wc->x = tmp_x + frameLeft (c);
3192- wc->width = tmp_w - frameLeft (c) - frameRight (c);
3193- break;
3194- default:
3195- clientMaxSpace (screen_info, &tmp_x, &full_y, &tmp_w, &full_h);
3196- break;
3197- }
3198-
3199- wc->y = full_y + frameTop (c);
3200- wc->height = full_h - frameTop (c) - frameBottom (c);
3201-
3202- return (wc->height <= c->size->max_height);
3203- }
3204-
3205- return TRUE;
3206-}
3207-
3208-gboolean
3209-clientToggleMaximized (Client *c, int mode, gboolean restore_position)
3210-{
3211- DisplayInfo *display_info;
3212- ScreenInfo *screen_info;
3213- XWindowChanges wc;
3214- GdkRectangle rect;
3215- unsigned long old_flags;
3216-
3217- g_return_val_if_fail (c != NULL, FALSE);
3218-
3219- TRACE ("entering clientToggleMaximized");
3220- TRACE ("maximzing/unmaximizing client \"%s\" (0x%lx)", c->name, c->window);
3221-
3222- if (!CLIENT_CAN_MAXIMIZE_WINDOW (c))
3223- {
3224- return FALSE;
3225- }
3226-
3227- screen_info = c->screen_info;
3228- display_info = screen_info->display_info;
3229- myScreenFindMonitorAtPoint (screen_info,
3230- frameX (c) + (frameWidth (c) / 2),
3231- frameY (c) + (frameHeight (c) / 2), &rect);
3232-
3233- wc.x = c->x;
3234- wc.y = c->y;
3235- wc.width = c->width;
3236- wc.height = c->height;
3237-
3238- if (restore_position &&
3239- FLAG_TEST (mode, CLIENT_FLAG_MAXIMIZED) &&
3240- !FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
3241- {
3242- clientSaveSizePos (c);
3243- }
3244-
3245- old_flags = c->flags;
3246-
3247- /* 1) Compute the new state */
3248- clientNewMaxState (c, &wc, mode);
3249-
3250- /* 2) Compute the new size, based on the state */
3251- if (!clientNewMaxSize (c, &wc, &rect, TILE_NONE))
3252- {
3253- c->flags = old_flags;
3254- return FALSE;
3255- }
3256-
3257- /* 3) Update size and position fields */
3258- c->x = wc.x;
3259- c->y = wc.y;
3260- c->height = wc.height;
3261- c->width = wc.width;
3262-
3263- /* Maximizing may remove decoration on the side, update NET_FRAME_EXTENTS accordingly */
3264- setNetFrameExtents (display_info,
3265- c->window,
3266- frameTop (c),
3267- frameLeft (c),
3268- frameRight (c),
3269- frameBottom (c));
3270-
3271- /* Maximized windows w/out border cannot be resized, update allowed actions */
3272- clientSetNetActions (c);
3273- if (restore_position && FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MANAGED))
3274- {
3275- clientConfigure (c, &wc, CWWidth | CWHeight | CWX | CWY, CFG_FORCE_REDRAW);
3276- }
3277- clientSetNetState (c);
3278-
3279- return TRUE;
3280-}
3281-
3282-gboolean
3283-clientTile (Client *c, gint cx, gint cy, tilePositionType tile, gboolean send_configure)
3284-{
3285- DisplayInfo *display_info;
3286- ScreenInfo *screen_info;
3287- XWindowChanges wc;
3288- GdkRectangle rect;
3289- unsigned long old_flags;
3290- int mode;
3291-
3292- g_return_val_if_fail (c != NULL, FALSE);
3293-
3294- TRACE ("entering clientTile");
3295- TRACE ("Tiling client \"%s\" (0x%lx)", c->name, c->window);
3296-
3297- if (!CLIENT_CAN_TILE_WINDOW (c))
3298- {
3299- return FALSE;
3300- }
3301-
3302- screen_info = c->screen_info;
3303- display_info = screen_info->display_info;
3304- myScreenFindMonitorAtPoint (screen_info, cx, cy, &rect);
3305-
3306- wc.x = c->x;
3307- wc.y = c->y;
3308- wc.width = c->width;
3309- wc.height = c->height;
3310-
3311- switch (tile)
3312- {
3313- case TILE_LEFT:
3314- case TILE_RIGHT:
3315- mode = CLIENT_FLAG_MAXIMIZED_VERT;
3316- break;
3317- case TILE_UP:
3318- case TILE_DOWN:
3319- mode = CLIENT_FLAG_MAXIMIZED_HORIZ;
3320- break;
3321- default:
3322- return FALSE;
3323- break;
3324- }
3325-
3326- if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
3327- {
3328- clientSaveSizePos (c);
3329- }
3330-
3331- old_flags = c->flags;
3332- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED);
3333- clientNewMaxState (c, &wc, mode);
3334- if (!clientNewMaxSize (c, &wc, &rect, tile))
3335- {
3336- c->flags = old_flags;
3337- return FALSE;
3338- }
3339-
3340- c->x = wc.x;
3341- c->y = wc.y;
3342- c->height = wc.height;
3343- c->width = wc.width;
3344-
3345- if (send_configure)
3346- {
3347- setNetFrameExtents (display_info,
3348- c->window,
3349- frameTop (c),
3350- frameLeft (c),
3351- frameRight (c),
3352- frameBottom (c));
3353-
3354- clientSetNetActions (c);
3355-
3356- clientConfigure (c, &wc, CWWidth | CWHeight | CWX | CWY, CFG_FORCE_REDRAW);
3357- }
3358- clientSetNetState (c);
3359-
3360- return TRUE;
3361-}
3362-
3363-void
3364-clientUpdateOpacity (Client *c)
3365-{
3366- ScreenInfo *screen_info;
3367- DisplayInfo *display_info;
3368- Client *focused;
3369- gboolean opaque;
3370-
3371- g_return_if_fail (c != NULL);
3372-
3373- screen_info = c->screen_info;
3374- display_info = screen_info->display_info;
3375- if (!compositorIsUsable (display_info))
3376- {
3377- return;
3378- }
3379-
3380- focused = clientGetFocus ();
3381- opaque = (FLAG_TEST(c->type, WINDOW_TYPE_DONT_PLACE | WINDOW_TYPE_DONT_FOCUS)
3382- || (focused == c));
3383-
3384- clientSetOpacity (c, c->opacity, OPACITY_INACTIVE, opaque ? 0 : OPACITY_INACTIVE);
3385-}
3386-
3387-void
3388-clientUpdateAllOpacity (ScreenInfo *screen_info)
3389-{
3390- DisplayInfo *display_info;
3391- Client *c;
3392- guint i;
3393-
3394- g_return_if_fail (screen_info != NULL);
3395-
3396- display_info = screen_info->display_info;
3397- if (!compositorIsUsable (display_info))
3398- {
3399- return;
3400- }
3401-
3402- for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, ++i)
3403- {
3404- clientUpdateOpacity (c);
3405- }
3406-}
3407-
3408-void
3409-clientSetOpacity (Client *c, guint opacity, guint clear, guint xor)
3410-{
3411- ScreenInfo *screen_info;
3412- DisplayInfo *display_info;
3413- guint applied;
3414-
3415- screen_info = c->screen_info;
3416- display_info = screen_info->display_info;
3417-
3418- if (!compositorIsUsable (display_info))
3419- {
3420- return;
3421- }
3422-
3423- c->opacity_flags = (c->opacity_flags & ~clear) ^ xor;
3424-
3425- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED))
3426- {
3427- applied = c->opacity;
3428- }
3429- else
3430- {
3431- long long multiplier = 1, divisor = 1;
3432-
3433- c->opacity = applied = opacity;
3434-
3435- if (FLAG_TEST (c->opacity_flags, OPACITY_MOVE))
3436- {
3437- multiplier *= c->screen_info->params->move_opacity;
3438- divisor *= 100;
3439- }
3440- if (FLAG_TEST (c->opacity_flags, OPACITY_RESIZE))
3441- {
3442- multiplier *= c->screen_info->params->resize_opacity;
3443- divisor *= 100;
3444- }
3445- if (FLAG_TEST (c->opacity_flags, OPACITY_INACTIVE))
3446- {
3447- multiplier *= c->screen_info->params->inactive_opacity;
3448- divisor *= 100;
3449- }
3450-
3451- applied = (guint) ((long long) applied * multiplier / divisor);
3452- }
3453-
3454- if (applied != c->opacity_applied)
3455- {
3456- c->opacity_applied = applied;
3457- compositorWindowSetOpacity (display_info, c->frame, applied);
3458- }
3459-}
3460-
3461-void
3462-clientDecOpacity (Client *c)
3463-{
3464- ScreenInfo *screen_info;
3465- DisplayInfo *display_info;
3466-
3467- screen_info = c->screen_info;
3468- display_info = screen_info->display_info;
3469-
3470- if (!compositorIsUsable (display_info))
3471- {
3472- return;
3473- }
3474-
3475- if ((c->opacity > OPACITY_SET_MIN) && !(FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED)))
3476- {
3477- clientSetOpacity (c, c->opacity - OPACITY_SET_STEP, 0, 0);
3478- }
3479-}
3480-
3481-void
3482-clientIncOpacity (Client *c)
3483-{
3484- ScreenInfo *screen_info;
3485- DisplayInfo *display_info;
3486-
3487- screen_info = c->screen_info;
3488- display_info = screen_info->display_info;
3489-
3490- if (!compositorIsUsable (display_info))
3491- {
3492- return;
3493- }
3494-
3495- if ((c->opacity < NET_WM_OPAQUE) && !(FLAG_TEST (c->xfwm_flags, XFWM_FLAG_OPACITY_LOCKED)))
3496- {
3497- guint opacity = c->opacity + OPACITY_SET_STEP;
3498-
3499- if (opacity < OPACITY_SET_MIN)
3500- {
3501- opacity = NET_WM_OPAQUE;
3502- }
3503- clientSetOpacity (c, opacity, 0, 0);
3504- }
3505-}
3506-
3507-/* Xrandr stuff: on screen size change, make sure all clients are still visible */
3508-void
3509-clientScreenResize(ScreenInfo *screen_info, gboolean fully_visible)
3510-{
3511- Client *c = NULL;
3512- GList *list, *list_of_windows;
3513- XWindowChanges wc;
3514- unsigned short configure_flags;
3515-
3516- list_of_windows = clientGetStackList (screen_info);
3517-
3518- if (!list_of_windows)
3519- {
3520- return;
3521- }
3522-
3523- /* Revalidate client struts */
3524- for (list = list_of_windows; list; list = g_list_next (list))
3525- {
3526- c = (Client *) list->data;
3527- if (FLAG_TEST (c->flags, CLIENT_FLAG_HAS_STRUT))
3528- {
3529- clientValidateNetStrut (c);
3530- }
3531- }
3532-
3533- for (list = list_of_windows; list; list = g_list_next (list))
3534- {
3535- unsigned long maximization_flags = 0L;
3536-
3537- c = (Client *) list->data;
3538- if (!CONSTRAINED_WINDOW (c))
3539- {
3540- continue;
3541- }
3542-
3543- /* Recompute size and position of maximized windows */
3544- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
3545- {
3546- maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED;
3547-
3548- /* Force an update by clearing the internal flags */
3549- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED);
3550- clientToggleMaximized (c, maximization_flags, FALSE);
3551-
3552- wc.x = c->x;
3553- wc.y = c->y;
3554- wc.width = c->width;
3555- wc.height = c->height;
3556- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_NOTIFY);
3557- }
3558- else if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
3559- {
3560- clientUpdateFullscreenSize (c);
3561- }
3562- else
3563- {
3564- configure_flags = CFG_CONSTRAINED | CFG_REQUEST;
3565- if (fully_visible)
3566- {
3567- configure_flags |= CFG_KEEP_VISIBLE;
3568- }
3569- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SAVED_POS))
3570- {
3571- wc.x = c->saved_x;
3572- wc.y = c->saved_y;
3573- }
3574- else
3575- {
3576- FLAG_SET (c->xfwm_flags, XFWM_FLAG_SAVED_POS);
3577-
3578- c->saved_x = c->x;
3579- c->saved_y = c->y;
3580-
3581- wc.x = c->x;
3582- wc.y = c->y;
3583- }
3584-
3585- clientConfigure (c, &wc, CWX | CWY, configure_flags);
3586- }
3587- }
3588-
3589- g_list_free (list_of_windows);
3590-}
3591-
3592-void
3593-clientUpdateCursor (Client *c)
3594-{
3595- ScreenInfo *screen_info;
3596- DisplayInfo *display_info;
3597- guint i;
3598-
3599- g_return_if_fail (c != NULL);
3600-
3601- screen_info = c->screen_info;
3602- display_info = screen_info->display_info;
3603-
3604- for (i = 0; i <= SIDE_TOP; i++)
3605- {
3606- xfwmWindowSetCursor (&c->sides[i],
3607- myDisplayGetCursorResize(display_info, CORNER_COUNT + i));
3608- }
3609-
3610- for (i = 0; i < CORNER_COUNT; i++)
3611- {
3612- xfwmWindowSetCursor (&c->corners[i],
3613- myDisplayGetCursorResize(display_info, i));
3614- }
3615-}
3616-
3617-void
3618-clientUpdateAllCursor (ScreenInfo *screen_info)
3619-{
3620- Client *c;
3621- guint i;
3622-
3623- g_return_if_fail (screen_info != NULL);
3624-
3625- for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, ++i)
3626- {
3627- clientUpdateCursor (c);
3628- }
3629-}
3630-
3631-static eventFilterStatus
3632-clientButtonPressEventFilter (XEvent * xevent, gpointer data)
3633-{
3634- ScreenInfo *screen_info;
3635- DisplayInfo *display_info;
3636- Client *c;
3637- ButtonPressData *passdata;
3638- eventFilterStatus status;
3639- int b;
3640- gboolean pressed;
3641-
3642- passdata = (ButtonPressData *) data;
3643- c = passdata->c;
3644- b = passdata->b;
3645-
3646- screen_info = c->screen_info;
3647- display_info = screen_info->display_info;
3648-
3649- /* Update the display time */
3650- myDisplayUpdateCurrentTime (display_info, xevent);
3651-
3652- status = EVENT_FILTER_STOP;
3653- pressed = TRUE;
3654-
3655- switch (xevent->type)
3656- {
3657- case EnterNotify:
3658- if ((xevent->xcrossing.mode != NotifyGrab) && (xevent->xcrossing.mode != NotifyUngrab))
3659- {
3660- c->button_status[b] = BUTTON_STATE_PRESSED;
3661- frameQueueDraw (c, FALSE);
3662- }
3663- break;
3664- case LeaveNotify:
3665- if ((xevent->xcrossing.mode != NotifyGrab) && (xevent->xcrossing.mode != NotifyUngrab))
3666- {
3667- c->button_status[b] = BUTTON_STATE_NORMAL;
3668- frameQueueDraw (c, FALSE);
3669- }
3670- break;
3671- case ButtonRelease:
3672- pressed = FALSE;
3673- break;
3674- case UnmapNotify:
3675- if (xevent->xunmap.window == c->window)
3676- {
3677- pressed = FALSE;
3678- c->button_status[b] = BUTTON_STATE_NORMAL;
3679- }
3680- break;
3681- case KeyPress:
3682- case KeyRelease:
3683- break;
3684- default:
3685- status = EVENT_FILTER_CONTINUE;
3686- break;
3687- }
3688-
3689- if (!pressed)
3690- {
3691- TRACE ("event loop now finished");
3692- gtk_main_quit ();
3693- }
3694-
3695- return status;
3696-}
3697-
3698-void
3699-clientButtonPress (Client *c, Window w, XButtonEvent * bev)
3700-{
3701- ScreenInfo *screen_info;
3702- DisplayInfo *display_info;
3703- ButtonPressData passdata;
3704- int b, g1;
3705-
3706- g_return_if_fail (c != NULL);
3707- TRACE ("entering clientButtonPress");
3708-
3709- for (b = 0; b < BUTTON_COUNT; b++)
3710- {
3711- if (MYWINDOW_XWINDOW (c->buttons[b]) == w)
3712- {
3713- break;
3714- }
3715- }
3716-
3717- screen_info = c->screen_info;
3718- display_info = screen_info->display_info;
3719-
3720- g1 = XGrabPointer (display_info->dpy, w, FALSE,
3721- ButtonReleaseMask | EnterWindowMask | LeaveWindowMask,
3722- GrabModeAsync, GrabModeAsync,
3723- screen_info->xroot, None,
3724- myDisplayGetCurrentTime (display_info));
3725-
3726- if (g1 != GrabSuccess)
3727- {
3728- TRACE ("grab failed in clientButtonPress");
3729- gdk_beep ();
3730- if (g1 == GrabSuccess)
3731- {
3732- XUngrabKeyboard (display_info->dpy, myDisplayGetCurrentTime (display_info));
3733- }
3734- return;
3735- }
3736-
3737- passdata.c = c;
3738- passdata.b = b;
3739-
3740- c->button_status[b] = BUTTON_STATE_PRESSED;
3741- frameQueueDraw (c, FALSE);
3742-
3743- TRACE ("entering button press loop");
3744- eventFilterPush (display_info->xfilter, clientButtonPressEventFilter, &passdata);
3745- gtk_main ();
3746- eventFilterPop (display_info->xfilter);
3747- TRACE ("leaving button press loop");
3748-
3749- XUngrabPointer (display_info->dpy, myDisplayGetCurrentTime (display_info));
3750-
3751- if (c->button_status[b] == BUTTON_STATE_PRESSED)
3752- {
3753- /*
3754- * Button was pressed at the time, means the pointer was still within
3755- * the button, so return to prelight if available, normal otherwise.
3756- */
3757- if (!xfwmPixmapNone(clientGetButtonPixmap(c, b, PRELIGHT)))
3758- {
3759- c->button_status[b] = BUTTON_STATE_PRELIGHT;
3760- }
3761- else
3762- {
3763- c->button_status[b] = BUTTON_STATE_NORMAL;
3764- }
3765-
3766- switch (b)
3767- {
3768- case HIDE_BUTTON:
3769- if (CLIENT_CAN_HIDE_WINDOW (c))
3770- {
3771- clientWithdraw (c, c->win_workspace, TRUE);
3772- }
3773- break;
3774- case CLOSE_BUTTON:
3775- clientClose (c);
3776- break;
3777- case MAXIMIZE_BUTTON:
3778- if (CLIENT_CAN_MAXIMIZE_WINDOW (c))
3779- {
3780- if (bev->button == Button1)
3781- {
3782- clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED, TRUE);
3783- }
3784- else if (bev->button == Button2)
3785- {
3786- clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED_VERT, TRUE);
3787- }
3788- else if (bev->button == Button3)
3789- {
3790- clientToggleMaximized (c, CLIENT_FLAG_MAXIMIZED_HORIZ, TRUE);
3791- }
3792- }
3793- break;
3794- case SHADE_BUTTON:
3795- clientToggleShaded (c);
3796- break;
3797- case STICK_BUTTON:
3798- clientToggleSticky (c, TRUE);
3799- break;
3800- default:
3801- break;
3802- }
3803- frameQueueDraw (c, FALSE);
3804- }
3805-}
3806-
3807-xfwmPixmap *
3808-clientGetButtonPixmap (Client *c, int button, int state)
3809-{
3810- ScreenInfo *screen_info;
3811-
3812- TRACE ("entering clientGetButtonPixmap button=%i, state=%i", button, state);
3813- screen_info = c->screen_info;
3814- switch (button)
3815- {
3816- case MENU_BUTTON:
3817- if ((screen_info->params->show_app_icon)
3818- && (!xfwmPixmapNone(&c->appmenu[state])))
3819- {
3820- return &c->appmenu[state];
3821- }
3822- break;
3823- case SHADE_BUTTON:
3824- if (FLAG_TEST (c->flags, CLIENT_FLAG_SHADED)
3825- && (!xfwmPixmapNone(&screen_info->buttons[SHADE_BUTTON][state + STATE_TOGGLED])))
3826- {
3827- return &screen_info->buttons[SHADE_BUTTON][state + STATE_TOGGLED];
3828- }
3829- return &screen_info->buttons[SHADE_BUTTON][state];
3830- break;
3831- case STICK_BUTTON:
3832- if (FLAG_TEST (c->flags, CLIENT_FLAG_STICKY)
3833- && (!xfwmPixmapNone(&screen_info->buttons[STICK_BUTTON][state + STATE_TOGGLED])))
3834- {
3835- return &screen_info->buttons[STICK_BUTTON][state + STATE_TOGGLED];
3836- }
3837- return &screen_info->buttons[STICK_BUTTON][state];
3838- break;
3839- case MAXIMIZE_BUTTON:
3840- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED)
3841- && (!xfwmPixmapNone(&screen_info->buttons[MAXIMIZE_BUTTON][state + STATE_TOGGLED])))
3842- {
3843- return &screen_info->buttons[MAXIMIZE_BUTTON][state + STATE_TOGGLED];
3844- }
3845- return &screen_info->buttons[MAXIMIZE_BUTTON][state];
3846- break;
3847- default:
3848- break;
3849- }
3850- return &screen_info->buttons[button][state];
3851-}
3852-
3853-int
3854-clientGetButtonState (Client *c, int button, int state)
3855-{
3856- if (state == INACTIVE)
3857- {
3858- return (state);
3859- }
3860-
3861- if ((c->button_status[button] == BUTTON_STATE_PRESSED) &&
3862- clientGetButtonPixmap (c, button, PRESSED))
3863- {
3864- return (PRESSED);
3865- }
3866-
3867- if ((c->button_status[button] == BUTTON_STATE_PRELIGHT) &&
3868- clientGetButtonPixmap (c, button, PRELIGHT))
3869- {
3870- return (PRELIGHT);
3871- }
3872-
3873- return (ACTIVE);
3874-}
3875-
3876-
3877-Client *
3878-clientGetLeader (Client *c)
3879-{
3880- TRACE ("entering clientGetLeader");
3881- g_return_val_if_fail (c != NULL, NULL);
3882-
3883- if (c->group_leader != None)
3884- {
3885- return myScreenGetClientFromWindow (c->screen_info, c->group_leader, SEARCH_WINDOW);
3886- }
3887- else if (c->client_leader != None)
3888- {
3889- return myScreenGetClientFromWindow (c->screen_info, c->client_leader, SEARCH_WINDOW);
3890- }
3891- return NULL;
3892-}
3893-
3894-#ifdef HAVE_LIBSTARTUP_NOTIFICATION
3895-char *
3896-clientGetStartupId (Client *c)
3897-{
3898- ScreenInfo *screen_info;
3899- DisplayInfo *display_info;
3900- gboolean got_startup_id;
3901-
3902- g_return_val_if_fail (c != NULL, NULL);
3903- g_return_val_if_fail (c->window != None, NULL);
3904-
3905- screen_info = c->screen_info;
3906- display_info = screen_info->display_info;
3907- got_startup_id = FALSE;
3908-
3909- if (c->startup_id)
3910- {
3911- return (c->startup_id);
3912- }
3913-
3914- got_startup_id = getWindowStartupId (display_info, c->window, &c->startup_id);
3915-
3916- if (!got_startup_id && (c->client_leader))
3917- {
3918- got_startup_id = getWindowStartupId (display_info, c->client_leader, &c->startup_id);
3919- }
3920-
3921- if (!got_startup_id && (c->group_leader))
3922- {
3923- got_startup_id = getWindowStartupId (display_info, c->group_leader, &c->startup_id);
3924- }
3925-
3926- return (c->startup_id);
3927-}
3928-#endif /* HAVE_LIBSTARTUP_NOTIFICATION */
3929
3930=== removed directory '.pc/02-remove-unused-maximize-button.patch'
3931=== removed directory '.pc/02-remove-unused-maximize-button.patch/src'
3932=== removed file '.pc/02-remove-unused-maximize-button.patch/src/client.c'
3933--- .pc/02-remove-unused-maximize-button.patch/src/client.c 2014-08-27 08:17:29 +0000
3934+++ .pc/02-remove-unused-maximize-button.patch/src/client.c 1970-01-01 00:00:00 +0000
3935@@ -1,3926 +0,0 @@
3936-/* $Id$
3937-
3938- This program is free software; you can redistribute it and/or modify
3939- it under the terms of the GNU General Public License as published by
3940- the Free Software Foundation; either version 2, or (at your option)
3941- any later version.
3942-
3943- This program is distributed in the hope that it will be useful,
3944- but WITHOUT ANY WARRANTY; without even the implied warranty of
3945- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3946- GNU General Public License for more details.
3947-
3948- You should have received a copy of the GNU General Public License
3949- along with this program; if not, write to the Free Software
3950- Foundation, Inc., Inc., 51 Franklin Street, Fifth Floor, Boston,
3951- MA 02110-1301, USA.
3952-
3953-
3954- oroborus - (c) 2001 Ken Lynch
3955- xfwm4 - (c) 2002-2011 Olivier Fourdan
3956-
3957- */
3958-
3959-#ifdef HAVE_CONFIG_H
3960-#include "config.h"
3961-#endif
3962-
3963-#include <sys/types.h>
3964-#include <signal.h>
3965-#include <unistd.h>
3966-#include <errno.h>
3967-
3968-#include <X11/X.h>
3969-#include <X11/Xlib.h>
3970-#include <X11/Xutil.h>
3971-#include <X11/Xatom.h>
3972-#include <X11/extensions/shape.h>
3973-
3974-#include <glib.h>
3975-#include <gdk/gdk.h>
3976-#include <gdk/gdkx.h>
3977-#include <gtk/gtk.h>
3978-#include <libxfce4util/libxfce4util.h>
3979-
3980-#include "client.h"
3981-#include "compositor.h"
3982-#include "focus.h"
3983-#include "frame.h"
3984-#include "hints.h"
3985-#include "icons.h"
3986-#include "misc.h"
3987-#include "moveresize.h"
3988-#include "mypixmap.h"
3989-#include "mywindow.h"
3990-#include "netwm.h"
3991-#include "placement.h"
3992-#include "screen.h"
3993-#include "session.h"
3994-#include "settings.h"
3995-#include "stacking.h"
3996-#include "startup_notification.h"
3997-#include "transients.h"
3998-#include "workspaces.h"
3999-#include "xsync.h"
4000-#include "event_filter.h"
4001-
4002-/* Event mask definition */
4003-
4004-#define POINTER_EVENT_MASK \
4005- ButtonPressMask|\
4006- ButtonReleaseMask
4007-
4008-#define FRAME_EVENT_MASK \
4009- SubstructureNotifyMask|\
4010- SubstructureRedirectMask|\
4011- PointerMotionMask|\
4012- ButtonMotionMask|\
4013- FocusChangeMask|\
4014- EnterWindowMask|\
4015- PropertyChangeMask
4016-
4017-#define CLIENT_EVENT_MASK \
4018- StructureNotifyMask|\
4019- FocusChangeMask|\
4020- PropertyChangeMask
4021-
4022-#define BUTTON_EVENT_MASK \
4023- EnterWindowMask|\
4024- LeaveWindowMask
4025-
4026-/* Useful macros */
4027-#define START_ICONIC(c) \
4028- ((c->wmhints) && \
4029- (c->wmhints->initial_state == IconicState) && \
4030- !clientIsTransientOrModal (c))
4031-
4032-#define OPACITY_SET_STEP (guint) 0x16000000
4033-#define OPACITY_SET_MIN (guint) 0x40000000
4034-
4035-typedef struct _ButtonPressData ButtonPressData;
4036-struct _ButtonPressData
4037-{
4038- int b;
4039- Client *c;
4040-};
4041-
4042-/* Forward decl */
4043-static void
4044-clientUpdateIconPix (Client *c);
4045-static gboolean
4046-clientNewMaxSize (Client *c, XWindowChanges *wc, GdkRectangle *, tilePositionType tile);
4047-
4048-Display *
4049-clientGetXDisplay (Client *c)
4050-{
4051- g_return_val_if_fail (c, NULL);
4052-
4053- return myScreenGetXDisplay (c->screen_info);
4054-}
4055-
4056-void
4057-clientInstallColormaps (Client *c)
4058-{
4059- XWindowAttributes attr;
4060- gboolean installed;
4061- int i;
4062-
4063- g_return_if_fail (c != NULL);
4064- TRACE ("entering clientInstallColormaps");
4065-
4066- installed = FALSE;
4067- if (c->ncmap)
4068- {
4069- for (i = c->ncmap - 1; i >= 0; i--)
4070- {
4071- XGetWindowAttributes (clientGetXDisplay (c), c->cmap_windows[i], &attr);
4072- XInstallColormap (clientGetXDisplay (c), attr.colormap);
4073- if (c->cmap_windows[i] == c->window)
4074- {
4075- installed = TRUE;
4076- }
4077- }
4078- }
4079- if ((!installed) && (c->cmap))
4080- {
4081- XInstallColormap (clientGetXDisplay (c), c->cmap);
4082- }
4083-}
4084-
4085-void
4086-clientUpdateColormaps (Client *c)
4087-{
4088- g_return_if_fail (c != NULL);
4089- TRACE ("entering clientUpdateColormaps");
4090-
4091- if (c->ncmap)
4092- {
4093- XFree (c->cmap_windows);
4094- c->ncmap = 0;
4095- }
4096- if (!XGetWMColormapWindows (clientGetXDisplay (c), c->window, &c->cmap_windows, &c->ncmap))
4097- {
4098- c->cmap_windows = NULL;
4099- c->ncmap = 0;
4100- }
4101-}
4102-
4103-static gchar*
4104-clientCreateTitleName (Client *c, gchar *name, gchar *hostname)
4105-{
4106- ScreenInfo *screen_info;
4107- DisplayInfo *display_info;
4108- gchar *title;
4109-
4110- g_return_val_if_fail (c != NULL, NULL);
4111- TRACE ("entering clientCreateTitleName");
4112-
4113- screen_info = c->screen_info;
4114- display_info = screen_info->display_info;
4115-
4116- if (strlen (hostname) && (display_info->hostname) && (g_ascii_strcasecmp (display_info->hostname, hostname)))
4117- {
4118- /* TRANSLATORS: "(on %s)" is like "running on" the name of the other host */
4119- title = g_strdup_printf (_("%s (on %s)"), name, hostname);
4120- }
4121- else
4122- {
4123- title = g_strdup (name);
4124- }
4125-
4126- return title;
4127-}
4128-
4129-void
4130-clientUpdateName (Client *c)
4131-{
4132- ScreenInfo *screen_info;
4133- DisplayInfo *display_info;
4134- gchar *hostname;
4135- gchar *wm_name;
4136- gchar *name;
4137- gboolean refresh;
4138-
4139- g_return_if_fail (c != NULL);
4140- TRACE ("entering clientUpdateName");
4141-
4142- screen_info = c->screen_info;
4143- display_info = screen_info->display_info;
4144-
4145- getWindowName (display_info, c->window, &wm_name);
4146- getWindowHostname (display_info, c->window, &hostname);
4147- refresh = FALSE;
4148-
4149- /* Update hostname too, as it's used when terminating a client */
4150- if (hostname)
4151- {
4152- if (c->hostname)
4153- {
4154- g_free (c->hostname);
4155- }
4156- c->hostname = hostname;
4157- }
4158-
4159- if (wm_name)
4160- {
4161- name = clientCreateTitleName (c, wm_name, hostname);
4162- g_free (wm_name);
4163- if (c->name)
4164- {
4165- if (strcmp (name, c->name))
4166- {
4167- refresh = TRUE;
4168- FLAG_SET (c->flags, CLIENT_FLAG_NAME_CHANGED);
4169- }
4170- g_free (c->name);
4171- }
4172- c->name = name;
4173- }
4174-
4175- if (refresh)
4176- {
4177- frameQueueDraw (c, TRUE);
4178- }
4179-}
4180-
4181-void
4182-clientUpdateAllFrames (ScreenInfo *screen_info, int mask)
4183-{
4184- Client *c;
4185- XWindowChanges wc;
4186- guint i;
4187-
4188- g_return_if_fail (screen_info != NULL);
4189-
4190- TRACE ("entering clientRedrawAllFrames");
4191- for (c = screen_info->clients, i = 0; i < screen_info->client_count; c = c->next, i++)
4192- {
4193- unsigned long configure_flags = 0L;
4194-
4195- if (mask & UPDATE_BUTTON_GRABS)
4196- {
4197- clientUngrabButtons (c);
4198- clientGrabButtons (c);
4199- clientGrabMouseButton (c);
4200- }
4201- if (mask & UPDATE_CACHE)
4202- {
4203- clientUpdateIconPix (c);
4204- }
4205- if (mask & UPDATE_GRAVITY)
4206- {
4207- clientCoordGravitate (c, c->gravity, REMOVE, &c->x, &c->y);
4208- clientCoordGravitate (c, c->gravity, APPLY, &c->x, &c->y);
4209- setNetFrameExtents (screen_info->display_info,
4210- c->window,
4211- frameTop (c),
4212- frameLeft (c),
4213- frameRight (c),
4214- frameBottom (c));
4215- configure_flags |= CFG_FORCE_REDRAW;
4216- mask &= ~UPDATE_FRAME;
4217- }
4218- if (mask & UPDATE_MAXIMIZE)
4219- {
4220- unsigned long maximization_flags = 0L;
4221-
4222- /* Recompute size and position of maximized windows */
4223- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT))
4224- {
4225- maximization_flags = c->flags & CLIENT_FLAG_MAXIMIZED;
4226-
4227- /* Force an update by clearing the internal flags */
4228- FLAG_UNSET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ | CLIENT_FLAG_MAXIMIZED_VERT);
4229- clientToggleMaximized (c, maximization_flags, FALSE);
4230-
4231- configure_flags |= CFG_FORCE_REDRAW;
4232- mask &= ~UPDATE_FRAME;
4233- }
4234- }
4235- if (configure_flags != 0L)
4236- {
4237- wc.x = c->x;
4238- wc.y = c->y;
4239- wc.width = c->width;
4240- wc.height = c->height;
4241- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, configure_flags);
4242- }
4243- if (mask & UPDATE_FRAME)
4244- {
4245- frameQueueDraw (c, TRUE);
4246- }
4247-
4248- }
4249-}
4250-
4251-void
4252-clientGrabButtons (Client *c)
4253-{
4254- ScreenInfo *screen_info;
4255-
4256- g_return_if_fail (c != NULL);
4257- TRACE ("entering clientGrabButtons");
4258- TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window);
4259-
4260- screen_info = c->screen_info;
4261- if (screen_info->params->easy_click)
4262- {
4263- grabButton(clientGetXDisplay (c), AnyButton, screen_info->params->easy_click, c->window);
4264- }
4265-}
4266-
4267-void
4268-clientUngrabButtons (Client *c)
4269-{
4270- g_return_if_fail (c != NULL);
4271- TRACE ("entering clientUngrabButtons");
4272- TRACE ("grabbing buttons for client \"%s\" (0x%lx)", c->name, c->window);
4273-
4274- XUngrabButton (clientGetXDisplay (c), AnyButton, AnyModifier, c->window);
4275-}
4276-
4277-static gboolean
4278-urgent_cb (gpointer data)
4279-{
4280- Client *c;
4281- ScreenInfo *screen_info;
4282-
4283- c = (Client *) data;
4284- g_return_val_if_fail (c != NULL, FALSE);
4285- TRACE ("entering urgent_cb, iteration %i", c->blink_iterations);
4286- screen_info = c->screen_info;
4287-
4288- if (c != clientGetFocus ())
4289- {
4290- /*
4291- * If we do not blink on urgency, check if the window was last
4292- * drawn focused and redraw it unfocused.
4293- * This is for th case when the tuser changes the settings
4294- * in between two redraws.
4295- */
4296- if (!screen_info->params->urgent_blink)
4297- {
4298- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE))
4299- {
4300- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
4301- frameQueueDraw (c, FALSE);
4302- }
4303-
4304- if (c->blink_iterations)
4305- {
4306- c->blink_iterations = 0;
4307- }
4308- return TRUE;
4309- }
4310- /*
4311- * If we blink on urgency, check if we've not reach the number
4312- * of iterations and if not, simply change the status and redraw
4313- */
4314- if (c->blink_iterations < (2 * MAX_BLINK_ITERATIONS))
4315- {
4316- c->blink_iterations++;
4317- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
4318- frameQueueDraw (c, FALSE);
4319- return TRUE;
4320- }
4321- /*
4322- * If we reached the max number of iterations, check if we
4323- * repeat. If repeat_urgent_blink is set, redraw the frame and
4324- * restart counting from 1
4325- */
4326- if (screen_info->params->repeat_urgent_blink)
4327- {
4328- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
4329- frameQueueDraw (c, FALSE);
4330- c->blink_iterations = 1;
4331- return TRUE;
4332- }
4333- }
4334- else if (c->blink_iterations)
4335- {
4336- c->blink_iterations = 0;
4337- }
4338- return (TRUE);
4339-}
4340-
4341-void
4342-clientUpdateUrgency (Client *c)
4343-{
4344- g_return_if_fail (c != NULL);
4345-
4346- TRACE ("entering clientUpdateUrgency");
4347-
4348- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
4349- if (c->blink_timeout_id)
4350- {
4351- g_source_remove (c->blink_timeout_id);
4352- frameQueueDraw (c, FALSE);
4353- }
4354- FLAG_UNSET (c->wm_flags, WM_FLAG_URGENT);
4355-
4356- c->blink_timeout_id = 0;
4357- c->blink_iterations = 0;
4358- if ((c->wmhints) && (c->wmhints->flags & XUrgencyHint))
4359- {
4360- FLAG_SET (c->wm_flags, WM_FLAG_URGENT);
4361- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_VISIBLE))
4362- {
4363- c->blink_timeout_id =
4364- g_timeout_add_full (G_PRIORITY_DEFAULT,
4365- CLIENT_BLINK_TIMEOUT,
4366- (GtkFunction) urgent_cb,
4367- (gpointer) c, NULL);
4368- }
4369- }
4370- if (FLAG_TEST (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE)
4371- && !FLAG_TEST (c->wm_flags, WM_FLAG_URGENT)
4372- && (c != clientGetFocus ()))
4373- {
4374- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SEEN_ACTIVE);
4375- frameQueueDraw (c, FALSE);
4376- }
4377-}
4378-
4379-void
4380-clientCoordGravitate (Client *c, int gravity, int mode, int *x, int *y)
4381-{
4382- int dx, dy;
4383-
4384- g_return_if_fail (c != NULL);
4385- TRACE ("entering clientCoordGravitate");
4386-
4387- switch (gravity)
4388- {
4389- case CenterGravity:
4390- dx = (c->border_width * 2) - ((frameLeft (c) +
4391- frameRight (c)) / 2);
4392- dy = (c->border_width * 2) - ((frameTop (c) +
4393- frameBottom (c)) / 2);
4394- break;
4395- case NorthGravity:
4396- dx = (c->border_width * 2) - ((frameLeft (c) +
4397- frameRight (c)) / 2);
4398- dy = frameTop (c);
4399- break;
4400- case SouthGravity:
4401- dx = (c->border_width * 2) - ((frameLeft (c) +
4402- frameRight (c)) / 2);
4403- dy = (c->border_width * 2) - frameBottom (c);
4404- break;
4405- case EastGravity:
4406- dx = (c->border_width * 2) - frameRight (c);
4407- dy = (c->border_width * 2) - ((frameTop (c) +
4408- frameBottom (c)) / 2);
4409- break;
4410- case WestGravity:
4411- dx = frameLeft (c);
4412- dy = (c->border_width * 2) - ((frameTop (c) +
4413- frameBottom (c)) / 2);
4414- break;
4415- case NorthWestGravity:
4416- dx = frameLeft (c);
4417- dy = frameTop (c);
4418- break;
4419- case NorthEastGravity:
4420- dx = (c->border_width * 2) - frameRight (c);
4421- dy = frameTop (c);
4422- break;
4423- case SouthWestGravity:
4424- dx = frameLeft (c);
4425- dy = (c->border_width * 2) - frameBottom (c);
4426- break;
4427- case SouthEastGravity:
4428- dx = (c->border_width * 2) - frameRight (c);
4429- dy = (c->border_width * 2) - frameBottom (c);
4430- break;
4431- default:
4432- dx = 0;
4433- dy = 0;
4434- break;
4435- }
4436- *x = *x + (dx * mode);
4437- *y = *y + (dy * mode);
4438-}
4439-
4440-void
4441-clientAdjustCoordGravity (Client *c, int gravity, unsigned long *mask, XWindowChanges *wc)
4442-{
4443- int tx, ty, dw, dh;
4444-
4445- g_return_if_fail (c != NULL);
4446- TRACE ("entering clientAdjustCoordGravity");
4447-
4448- tx = wc->x;
4449- ty = wc->y;
4450- clientCoordGravitate (c, gravity, APPLY, &tx, &ty);
4451-
4452- switch (gravity)
4453- {
4454- case CenterGravity:
4455- dw = (c->width - wc->width) / 2;
4456- dh = (c->height - wc->height) / 2;
4457- break;
4458- case NorthGravity:
4459- dw = (c->width - wc->width) / 2;
4460- dh = 0;
4461- break;
4462- case SouthGravity:
4463- dw = (c->width - wc->width) / 2;
4464- dh = (c->height - wc->height);
4465- break;
4466- case EastGravity:
4467- dw = (c->width - wc->width);
4468- dh = (c->height - wc->height) / 2;
4469- break;
4470- case WestGravity:
4471- dw = 0;
4472- dh = (c->height - wc->height) / 2;
4473- break;
4474- case NorthWestGravity:
4475- dw = 0;
4476- dh = 0;
4477- break;
4478- case NorthEastGravity:
4479- dw = (c->width - wc->width);
4480- dh = 0;
4481- break;
4482- case SouthWestGravity:
4483- dw = 0;
4484- dh = (c->height - wc->height);
4485- break;
4486- case SouthEastGravity:
4487- dw = (c->width - wc->width);
4488- dh = (c->height - wc->height);
4489- break;
4490- default:
4491- dw = 0;
4492- dh = 0;
4493- break;
4494- }
4495-
4496- if (*mask & CWX)
4497- {
4498- wc->x = tx;
4499- }
4500- else if (*mask & CWWidth)
4501- {
4502- wc->x = c->x + dw;
4503- *mask |= CWX;
4504- }
4505-
4506- if (*mask & CWY)
4507- {
4508- wc->y = ty;
4509- }
4510- else if (*mask & CWHeight)
4511- {
4512- wc->y = c->y + dh;
4513- *mask |= CWY;
4514- }
4515-}
4516-
4517-#define WIN_MOVED (mask & (CWX | CWY))
4518-#define WIN_RESIZED (mask & (CWWidth | CWHeight))
4519-
4520-static void
4521-clientConfigureWindows (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
4522-{
4523- unsigned long change_mask_frame, change_mask_client;
4524- XWindowChanges change_values;
4525- DisplayInfo *display_info;
4526- ScreenInfo *screen_info;
4527-
4528- screen_info = c->screen_info;
4529- display_info = screen_info->display_info;
4530-
4531- change_mask_frame = mask & (CWX | CWY | CWWidth | CWHeight);
4532- change_mask_client = mask & (CWWidth | CWHeight);
4533-
4534- if ((WIN_RESIZED) || (flags & CFG_FORCE_REDRAW))
4535- {
4536- frameDraw (c, (flags & CFG_FORCE_REDRAW));
4537- }
4538-
4539- if (flags & CFG_FORCE_REDRAW)
4540- {
4541- change_mask_client |= (CWX | CWY);
4542- }
4543-
4544- if (change_mask_frame & (CWX | CWY | CWWidth | CWHeight))
4545- {
4546- change_values.x = frameX (c);
4547- change_values.y = frameY (c);
4548- change_values.width = frameWidth (c);
4549- change_values.height = frameHeight (c);
4550- XConfigureWindow (display_info->dpy, c->frame, change_mask_frame, &change_values);
4551- }
4552-
4553- if (change_mask_client & (CWX | CWY | CWWidth | CWHeight))
4554- {
4555- change_values.x = frameLeft (c);
4556- change_values.y = frameTop (c);
4557- change_values.width = c->width;
4558- change_values.height = c->height;
4559- XConfigureWindow (display_info->dpy, c->window, change_mask_client, &change_values);
4560- }
4561- if (WIN_RESIZED)
4562- {
4563- compositorResizeWindow (display_info, c->frame, frameX (c), frameY (c), frameWidth (c), frameHeight (c));
4564- }
4565-}
4566-
4567-void
4568-clientConfigure (Client *c, XWindowChanges * wc, unsigned long mask, unsigned short flags)
4569-{
4570- XConfigureEvent ce;
4571- int px, py, pwidth, pheight;
4572-
4573- g_return_if_fail (c != NULL);
4574- g_return_if_fail (c->window != None);
4575-
4576- TRACE ("entering clientConfigure");
4577- TRACE ("configuring client \"%s\" (0x%lx) %s, type %u", c->name,
4578- c->window, flags & CFG_CONSTRAINED ? "constrained" : "not contrained", c->type);
4579-
4580- px = c->x;
4581- py = c->y;
4582- pwidth = c->width;
4583- pheight = c->height;
4584-
4585- if (mask & CWX)
4586- {
4587- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING))
4588- {
4589- c->x = wc->x;
4590- }
4591- }
4592- if (mask & CWY)
4593- {
4594- if (!FLAG_TEST (c->xfwm_flags, XFWM_FLAG_MOVING_RESIZING))
4595- {
4596- c->y = wc->y;
4597- }
4598- }
4599- if (mask & CWWidth)
4600- {
4601- clientSetWidth (c, wc->width, flags & CFG_REQUEST);
4602- }
4603- if (mask & CWHeight)
4604- {
4605- clientSetHeight (c, wc->height, flags & CFG_REQUEST);
4606- }
4607- if (mask & CWBorderWidth)
4608- {
4609- c->border_width = wc->border_width;
4610- }
4611- if (mask & CWStackMode)
4612- {
4613- switch (wc->stack_mode)
4614- {
4615- /*
4616- * Limitation: we don't support neither
4617- * TopIf, BottomIf nor Opposite ...
4618- */
4619- case Above:
4620- TRACE ("Above");
4621- if (mask & CWSibling)
4622- {
4623- clientRaise (c, wc->sibling);
4624- }
4625- else
4626- {
4627- clientRaise (c, None);
4628- }
4629- break;
4630- case Below:
4631- TRACE ("Below");
4632- if (mask & CWSibling)
4633- {
4634- clientLower (c, wc->sibling);
4635- }
4636- else
4637- {
4638- clientLower (c, None);
4639- }
4640-
4641- break;
4642- case Opposite:
4643- case TopIf:
4644- case BottomIf:
4645- default:
4646- break;
4647- }
4648- }
4649- mask &= ~(CWStackMode | CWSibling);
4650-
4651- /* Keep control over what the application does. */
4652- if (((flags & (CFG_CONSTRAINED | CFG_REQUEST)) == (CFG_CONSTRAINED | CFG_REQUEST))
4653- && CONSTRAINED_WINDOW (c))
4654- {
4655- clientConstrainPos (c, flags & CFG_KEEP_VISIBLE);
4656-
4657- if (c->x != px)
4658- {
4659- mask |= CWX;
4660- }
4661- else
4662- {
4663- mask &= ~CWX;
4664- }
4665-
4666- if (c->y != py)
4667- {
4668- mask |= CWY;
4669- }
4670- else
4671- {
4672- mask &= ~CWY;
4673- }
4674-
4675- if (c->width != pwidth)
4676- {
4677- mask |= CWWidth;
4678- }
4679- else
4680- {
4681- mask &= ~CWWidth;
4682- }
4683- if (c->height != pheight)
4684- {
4685- mask |= CWHeight;
4686- }
4687- else
4688- {
4689- mask &= ~CWHeight;
4690- }
4691- }
4692-
4693- clientConfigureWindows (c, wc, mask, flags);
4694- /*
4695-
4696- We reparent the client window. According to the ICCCM spec, the
4697- WM must send a senthetic event when the window is moved and not resized.
4698-
4699- But, since we reparent the window, we must also send a synthetic
4700- configure event when the window is moved and resized.
4701-
4702- See this thread for the rational:
4703- http://www.mail-archive.com/wm-spec-list@gnome.org/msg00379.html
4704-
4705- And specifically this post from Carsten Haitzler:
4706- http://www.mail-archive.com/wm-spec-list@gnome.org/msg00382.html
4707-
4708- */
4709- if ((WIN_MOVED) || (flags & CFG_NOTIFY) ||
4710- ((flags & CFG_REQUEST) && !(WIN_MOVED || WIN_RESIZED)))
4711- {
4712- DBG ("Sending ConfigureNotify");
4713- ce.type = ConfigureNotify;
4714- ce.display = clientGetXDisplay (c);
4715- ce.event = c->window;
4716- ce.window = c->window;
4717- ce.x = c->x;
4718- ce.y = c->y;
4719- ce.width = c->width;
4720- ce.height = c->height;
4721- ce.border_width = 0;
4722- ce.above = c->frame;
4723- ce.override_redirect = FALSE;
4724- XSendEvent (clientGetXDisplay (c), c->window, FALSE,
4725- StructureNotifyMask, (XEvent *) & ce);
4726- }
4727-#undef WIN_MOVED
4728-#undef WIN_RESIZED
4729-}
4730-
4731-void
4732-clientMoveResizeWindow (Client *c, XWindowChanges * wc, unsigned long mask)
4733-{
4734- ScreenInfo *screen_info;
4735- DisplayInfo *display_info;
4736- unsigned short flags;
4737-
4738- g_return_if_fail (c != NULL);
4739- TRACE ("entering clientMoveResizeWindow");
4740- TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
4741-
4742- screen_info = c->screen_info;
4743- display_info = screen_info->display_info;
4744- if (c->type == WINDOW_DESKTOP)
4745- {
4746- /* Ignore stacking request for DESKTOP windows */
4747- mask &= ~(CWSibling | CWStackMode);
4748- }
4749- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN)
4750- || (FLAG_TEST_ALL (c->flags, CLIENT_FLAG_MAXIMIZED)
4751- && (screen_info->params->borderless_maximize)))
4752- {
4753- /* Not allowed in fullscreen or maximzed mode */
4754- mask &= ~(CWX | CWY | CWWidth | CWHeight);
4755- }
4756- /*clean up buggy requests that set all flags */
4757- if ((mask & CWX) && (wc->x == c->x))
4758- {
4759- mask &= ~CWX;
4760- }
4761- if ((mask & CWY) && (wc->y == c->y))
4762- {
4763- mask &= ~CWY;
4764- }
4765- if ((mask & CWWidth) && (wc->width == c->width))
4766- {
4767- mask &= ~CWWidth;
4768- }
4769- if ((mask & CWHeight) && (wc->height == c->height))
4770- {
4771- mask &= ~CWHeight;
4772- }
4773-
4774- /* Still a move/resize after cleanup? */
4775- flags = CFG_REQUEST;
4776- if (mask & (CWX | CWY | CWWidth | CWHeight))
4777- {
4778- /* Clear any previously saved pos flag from screen resize */
4779- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_SAVED_POS);
4780-
4781- if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
4782- {
4783- clientRemoveMaximizeFlag (c);
4784- }
4785-
4786- flags |= CFG_REQUEST | CFG_CONSTRAINED;
4787- }
4788- if ((mask & (CWWidth | CWHeight)) && !(mask & (CWX | CWY)))
4789- {
4790- /*
4791- * The client is resizing its window, but did not specify a
4792- * position, make sure the window remains fully visible in that
4793- *case so that the user does not have to relocate the window
4794- */
4795- flags |= CFG_KEEP_VISIBLE;
4796- }
4797- /*
4798- * Let's say that if the client performs a XRaiseWindow, we show the window if focus
4799- * stealing prevention is not activated, otherwise we just set the "demands attention"
4800- * flag...
4801- */
4802- if ((mask & CWStackMode) && (wc->stack_mode == Above) && (wc->sibling == None) && !(c->type & WINDOW_TYPE_DONT_FOCUS))
4803- {
4804- Client *last_raised;
4805-
4806- last_raised = clientGetLastRaise (screen_info);
4807- if (last_raised && (c != last_raised))
4808- {
4809- if ((screen_info->params->prevent_focus_stealing) && (screen_info->params->activate_action == ACTIVATE_ACTION_NONE))
4810- {
4811- mask &= ~(CWSibling | CWStackMode);
4812- TRACE ("Setting WM_STATE_DEMANDS_ATTENTION flag on \"%s\" (0x%lx)", c->name, c->window);
4813- FLAG_SET (c->flags, CLIENT_FLAG_DEMANDS_ATTENTION);
4814- clientSetNetState (c);
4815- }
4816- else
4817- {
4818- clientActivate (c, getXServerTime (display_info), FALSE);
4819- }
4820- }
4821- }
4822- /* And finally, configure the window */
4823- clientConfigure (c, wc, mask, flags);
4824-}
4825-
4826-void
4827-clientGetMWMHints (Client *c, gboolean update)
4828-{
4829- ScreenInfo *screen_info;
4830- DisplayInfo *display_info;
4831- PropMwmHints *mwm_hints;
4832- XWindowChanges wc;
4833-
4834- g_return_if_fail (c != NULL);
4835- g_return_if_fail (c->window != None);
4836-
4837- TRACE ("entering clientGetMWMHints client \"%s\" (0x%lx)", c->name,
4838- c->window);
4839-
4840- screen_info = c->screen_info;
4841- display_info = screen_info->display_info;
4842-
4843- mwm_hints = getMotifHints (display_info, c->window);
4844- if (mwm_hints)
4845- {
4846- if ((mwm_hints->flags & MWM_HINTS_DECORATIONS))
4847- {
4848- if (!FLAG_TEST (c->flags, CLIENT_FLAG_HAS_SHAPE))
4849- {
4850- if (mwm_hints->decorations & MWM_DECOR_ALL)
4851- {
4852- FLAG_SET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
4853- }
4854- else
4855- {
4856- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_HAS_BORDER | XFWM_FLAG_HAS_MENU);
4857- FLAG_SET (c->xfwm_flags, (mwm_hints-> decorations & (MWM_DECOR_TITLE | MWM_DECOR_BORDER))
4858- ? XFWM_FLAG_HAS_BORDER : 0);
4859- FLAG_SET (c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MENU))
4860- ? XFWM_FLAG_HAS_MENU : 0);
4861- /*
4862- FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
4863- FLAG_UNSET(c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE);
4864- FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MINIMIZE)) ? XFWM_FLAG_HAS_HIDE : 0);
4865- FLAG_SET(c->xfwm_flags, (mwm_hints->decorations & (MWM_DECOR_MAXIMIZE)) ? XFWM_FLAG_HAS_MAXIMIZE : 0);
4866- */
4867- }
4868- }
4869- }
4870- /* The following is from Metacity : */
4871- if (mwm_hints->flags & MWM_HINTS_FUNCTIONS)
4872- {
4873- if (!(mwm_hints->functions & MWM_FUNC_ALL))
4874- {
4875- FLAG_UNSET (c->xfwm_flags,
4876- XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE |
4877- XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE |
4878- XFWM_FLAG_HAS_RESIZE);
4879- }
4880- else
4881- {
4882- FLAG_SET (c->xfwm_flags,
4883- XFWM_FLAG_HAS_CLOSE | XFWM_FLAG_HAS_HIDE |
4884- XFWM_FLAG_HAS_MAXIMIZE | XFWM_FLAG_HAS_MOVE |
4885- XFWM_FLAG_HAS_RESIZE);
4886- }
4887-
4888- if (mwm_hints->functions & MWM_FUNC_CLOSE)
4889- {
4890- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_CLOSE);
4891- }
4892- if (mwm_hints->functions & MWM_FUNC_MINIMIZE)
4893- {
4894- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_HIDE);
4895- }
4896- if (mwm_hints->functions & MWM_FUNC_MAXIMIZE)
4897- {
4898- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MAXIMIZE);
4899- }
4900- if (mwm_hints->functions & MWM_FUNC_RESIZE)
4901- {
4902- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_RESIZE);
4903- }
4904- if (mwm_hints->functions & MWM_FUNC_MOVE)
4905- {
4906- FLAG_TOGGLE (c->xfwm_flags, XFWM_FLAG_HAS_MOVE);
4907- }
4908- }
4909- g_free (mwm_hints);
4910- }
4911-
4912- if (update)
4913- {
4914- wc.x = c->x;
4915- wc.y = c->y;
4916- wc.width = c->width;
4917- wc.height = c->height;
4918-
4919- if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN))
4920- {
4921- clientUpdateFullscreenSize (c);
4922- }
4923- /* If client is maximized, we need to update its coordonates and size as well */
4924- else if (FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED))
4925- {
4926- GdkRectangle rect;
4927- myScreenFindMonitorAtPoint (screen_info,
4928- frameX (c) + (frameWidth (c) / 2),
4929- frameY (c) + (frameHeight (c) / 2), &rect);
4930- clientNewMaxSize (c, &wc, &rect, TILE_NONE);
4931- }
4932-
4933- clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, CFG_FORCE_REDRAW);
4934-
4935- /* MWM hints can add or remove decorations, update NET_FRAME_EXTENTS accordingly */
4936- setNetFrameExtents (display_info,
4937- c->window,
4938- frameTop (c),
4939- frameLeft (c),
4940- frameRight (c),
4941- frameBottom (c));
4942- }
4943-}
4944-
4945-void
4946-clientGetWMNormalHints (Client *c, gboolean update)
4947-{
4948- XWindowChanges wc;
4949- unsigned long previous_value;
4950- long dummy;
4951-
4952- g_return_if_fail (c != NULL);
4953- g_return_if_fail (c->window != None);
4954-
4955- TRACE ("entering clientGetWMNormalHints client \"%s\" (0x%lx)", c->name,
4956- c->window);
4957-
4958- if (!c->size)
4959- {
4960- c->size = XAllocSizeHints ();
4961- }
4962- g_assert (c->size);
4963-
4964- dummy = 0;
4965- if (!XGetWMNormalHints (clientGetXDisplay (c), c->window, c->size, &dummy))
4966- {
4967- c->size->flags = 0;
4968- }
4969-
4970- /* Set/update gravity */
4971- c->gravity = c->size->flags & PWinGravity ? c->size->win_gravity : NorthWestGravity;
4972-
4973- previous_value = FLAG_TEST (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
4974- FLAG_UNSET (c->xfwm_flags, XFWM_FLAG_IS_RESIZABLE);
4975-
4976- wc.x = c->x;
4977- wc.y = c->y;
4978- wc.width = c->width;
4979- wc.height = c->height;
4980-
4981- if (!(c->size->flags & PMaxSize))
4982- {
4983- c->size->max_width = G_MAXINT;
4984- c->size->max_height = G_MAXINT;
4985- c->size->flags |= PMaxSize;
4986- }
4987-
4988- if (!(c->size->flags & PBaseSize))
4989- {
4990- c->size->base_width = 0;
4991- c->size->base_height = 0;
4992- }
4993-
4994- if (!(c->size->flags & PMinSize))
4995- {
4996- if ((c->size->flags & PBaseSize))
4997- {
4998- c->size->min_width = c->size->base_width;
4999- c->size->min_height = c->size->base_height;
5000- }
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to all changes: