From: Jerome St-Louis Date: Sun, 9 Feb 2014 00:42:02 +0000 (+0700) Subject: ecere/gui/drivers/XInterface: Always setting minimum width/height; Fixed jumping... X-Git-Tag: 0.44.09.9~81 X-Git-Url: https://ecere.com/cgi-bin/gitweb.cgi?p=sdk;a=commitdiff_plain;h=648417febc4963b204c5297724b2b9b65525f592 ecere/gui/drivers/XInterface: Always setting minimum width/height; Fixed jumping MessageBoxes on Cinnamon --- diff --git a/ecere/src/gui/dialogs/MessageBox.ec b/ecere/src/gui/dialogs/MessageBox.ec index 2193736..3b7ffde 100644 --- a/ecere/src/gui/dialogs/MessageBox.ec +++ b/ecere/src/gui/dialogs/MessageBox.ec @@ -127,6 +127,8 @@ private: bool OnResizing(int *w, int *h) { + if(!totalHeight) + OnLoadGraphics(); if(style == yesNoCancel) *w = Max(*w, Max(totalWidth, 208) + 24); else @@ -150,6 +152,12 @@ private: bool OnLoadGraphics() { MsgLine line; + // This is to set minimum client size on X11 + // Ideally OnLoadGraphics/OnResizing could be called prior to root window creation... + Display display = this.display; + Font fontObject = this.fontObject; + if(!display) display = master.display; + if(!fontObject) fontObject = master.fontObject; totalHeight = 0; for(line = lines.first; line; line = line.next) diff --git a/ecere/src/gui/drivers/XInterface.ec b/ecere/src/gui/drivers/XInterface.ec index ca9fae2..383a591 100644 --- a/ecere/src/gui/drivers/XInterface.ec +++ b/ecere/src/gui/drivers/XInterface.ec @@ -2408,6 +2408,18 @@ class XInterface : Interface int x = window.position.x + desktopX, y = window.position.y + desktopY; int w = window.state == normal ? Max(1, window.size.w) : Max(1, window.normalSizeAnchor.size.w); int h = window.state == normal ? Max(1, window.size.h) : Max(1, window.normalSizeAnchor.size.h); + MinMaxValue smw = 0, smh = 0; + MinMaxValue minW = window.minSize.w, minH = window.minSize.h; + window.OnResizing((int *)&minW, (int *)&minH); + + // To fix jumping message boxes on Cinnamon: + if(window.state == normal && (minW > window.minSize.w || minH > window.minSize.w)) + window.ComputeAnchors(window.normalAnchor, window.normalSizeAnchor, &x, &y, &w, &h); + + window.SetWindowMinimum(&smw, &smh); + minW = Max(minW, smw); + minH = Max(minH, smh); + if(!window.nativeDecorations && window.state != normal) { w += window.size.w - window.clientSize.w; @@ -2467,17 +2479,13 @@ class XInterface : Interface } // Set Normal hints for minimum/maximum size - if(true) //window.minSize.w || window.minSize.h || window.maxSize.w < MAXINT || window.maxSize.h < MAXINT) + if(true) { XSizeHints hints = { 0 }; - MinMaxValue mw, mh; - window.SetWindowMinimum(&mw, &mh); - if(window.minSize.w || window.minSize.h) - { - hints.min_width = Max(window.minSize.w, mw); - hints.min_height = Max(window.minSize.h, mh); - hints.flags |= PMinSize; - } + hints.min_width = minW; + hints.min_height = minH; + hints.flags |= PMinSize; + if(window.maxSize.w < MAXINT || window.minSize.h < MAXINT) { hints.max_width = window.maxSize.w;