Subject: Notification: incoming/896

From: [email-masked]
Date: Wed, 26 Jun 2002 21:16:27 -0500

FVWM Bug Tracking notification

new message incoming/896

Message summary for PR#896
	From: [email-masked]
	Subject: resize bugs
	Date: Wed, 26 Jun 2002 21:16:23 -0500
	0 replies 	0 followups

====> ORIGINAL MESSAGE FOLLOWS <====

>From [email-masked] Wed Jun 26 21:16:27 2002
From: [email-masked]
To: [email-masked]
Subject: resize bugs
Date: Wed, 26 Jun 2002 21:16:23 -0500

Full_Name: Neil Zanella
Version: 2.4.8
CVS_Date: 
OS: 
X_Server: 
Submission from: (NULL) (129.128.206.243)

The following code works under twm, mwm, window maker, and sawfish but
not under fvwm2. Under Red hat 7.3 compile it by placing it in
a file main.cpp under a directory called main. Then compile with:

qmake -project; qmake; make

and run with ./main

There are two problems:

1) Upon startup the grid is not 10x10 as it is under twm.

2) When the window is grabbed with the mouse, made really thin, then
   really tall and wide, and this is done many times quickly before
   the mouse is released, the window exhibits some strange resizing
   behavior and ends up resizing itself to some unreasonable size.

--- main.cpp ---

#include <qapplication.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <qvbox.h>

#define H 40
#define W 60

class Foo: public QVBox {
  public:
    Foo(QWidget *parent = 0): QVBox(parent) {
      bar = new QMenuBar(this);
      one = new QPopupMenu(bar);
      two = new QPopupMenu(bar);
      thr = new QPopupMenu(bar);
      bar->insertItem("The              ", one);
      bar->insertItem("Menu             ", two);
      bar->insertItem("Bar              ", thr);
      setSizeIncrement(W, H);
      resize(10 * W, 10 * H + bar->height());
    }
  protected:
    void paintEvent(QPaintEvent *);
  private:
    QMenuBar *bar;
    QPopupMenu *one;
    QPopupMenu *two;
    QPopupMenu *thr;
};

void Foo::paintEvent(QPaintEvent *) {
  int contentHeight = height() - bar->height();
  if (contentHeight % H != 0) {
    setBaseSize(W, bar->height() + H);
    resize(width(), height() - contentHeight % H);
  }
  QPainter p(this); int i, j;
  for (i = 0; i < height() / H; i++)
    for (j = 0; j < width() / W; j++)
      p.drawRect(j * W, i * H + bar->height(), W, H);
}

int main(int argc, char **argv) {
  QApplication app(argc, argv);
  Foo foo;
  app.setMainWidget(&foo);
  foo.show();
  return app.exec();
}

--
Visit the official FVWM web page at <URL:http://www.fvwm.org/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked]