* BUG: Make the component compile correctly.
* BUG: Does not crash anymore when closing a window during the _new() 
  method, or inside the Open event handler.


git-svn-id: svn://localhost/gambas/trunk@3089 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
Benoît Minisini 2010-08-02 20:39:28 +00:00
parent 68e1ec7d00
commit 67b9603177
3 changed files with 23 additions and 8 deletions

View File

@ -37,11 +37,13 @@
#include "gambas.h"
#include "main.h"
#include "x11.h"
#include "CMouse.h"
#define DO_NOT_DECLARE_EVENTS
#include "CWidget.h"
#include "CMenu.h"
#include "CWindow.h"
#include "x11.h"
#include "CTrayIcon.h"
DECLARE_METHOD(Control_ScreenX);
@ -531,9 +533,9 @@ bool CTrayIcon::eventFilter(QObject *widget, QEvent *event)
if (THIS->popup)
{
void *parent = GB.Parent(THIS);
if (parent && GB.Is(parent, Class_Control))
if (parent && GB.Is(parent, CLASS_Control))
{
CWINDOW *window = CWidget::getWindow(parent);
CWINDOW *window = CWidget::getWindow((CWIDGET *)parent);
CMENU *menu = CWindow::findMenu(window, THIS->popup);
if (menu)
CMENU_popup(menu, QCursor::pos());

View File

@ -43,6 +43,7 @@
#include <QDesktopWidget>
#include <QAction>
#include <QX11Info>
#include <QTimer>
#include "main.h"
@ -1591,6 +1592,7 @@ void MyMainWindow::showEvent(QShowEvent *e)
if (_activate)
{
qDebug("showEvent: activate: %s", THIS->widget.name);
raise();
//setFocus();
activateWindow();
@ -1624,6 +1626,11 @@ void MyMainWindow::afterShow()
}
}
void MyMainWindow::activateLater()
{
activateWindow();
}
void MyMainWindow::showActivate(QWidget *transient)
{
CWIDGET *_object = CWidget::get(this);
@ -1702,9 +1709,13 @@ void MyMainWindow::showActivate(QWidget *transient)
{*/
if (hasBorder())
{
MAIN_process_events();
usleep(50000);
activateWindow();
//MAIN_process_events();
//usleep(50000);
//_activate = TRUE;
if (isToolbar())
QTimer::singleShot(50, this, SLOT(activateLater()));
else
activateWindow();
}
}
else
@ -2566,8 +2577,6 @@ bool CWindow::eventFilter(QObject *o, QEvent *e)
{
if (THIS->toplevel)
{
//qDebug("Activate: ob = %p", THIS);
CWINDOW_activate((CWIDGET *)(CWINDOW_LastActive ? CWINDOW_LastActive : THIS));
//GB.Unref(POINTER(&CWINDOW_LastActive));
CWINDOW_LastActive = 0;

View File

@ -177,6 +177,10 @@ protected:
//bool eventFilter(QObject *, QEvent *);
public slots:
void activateLater();
public:
enum { BorderNone = 0, BorderFixed = 1, BorderResizable = 2 };