зеркало из https://github.com/mozilla/gecko-dev.git
animated things work, editor works, etc etc etc. be happy!
This commit is contained in:
Родитель
e5e34681bf
Коммит
7813f9550b
|
@ -64,6 +64,7 @@ NS_METHOD nsDialog::CreateNative(GtkWidget *parentWindow)
|
|||
gtk_widget_show(mShell);
|
||||
mWidget = gtk_layout_new(PR_FALSE, PR_FALSE);
|
||||
gtk_container_add(GTK_CONTAINER(mShell), mWidget);
|
||||
gtk_widget_set_app_paintable(mWidget, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -232,6 +232,24 @@ void InitMouseEvent(GdkEventButton *aGEB,
|
|||
}
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void InitDrawEvent(GdkRectangle *area,
|
||||
gpointer p,
|
||||
nsPaintEvent &anEvent,
|
||||
PRUint32 aEventType)
|
||||
{
|
||||
anEvent.message = aEventType;
|
||||
anEvent.widget = (nsWidget *) p;
|
||||
NS_ADDREF(anEvent.widget);
|
||||
|
||||
anEvent.eventStructType = NS_PAINT_EVENT;
|
||||
|
||||
if (area != NULL) {
|
||||
nsRect rect(area->x, area->y, area->width, area->height);
|
||||
anEvent.rect = ▭
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void InitExposeEvent(GdkEventExpose *aGEE,
|
||||
gpointer p,
|
||||
|
@ -417,6 +435,18 @@ gint handle_configure_event(GtkWidget *w, GdkEventConfigure *conf, gpointer p)
|
|||
}
|
||||
#endif
|
||||
|
||||
gint handle_draw_event(GtkWidget *w, GdkRectangle *area, gpointer p)
|
||||
{
|
||||
nsPaintEvent pevent;
|
||||
InitDrawEvent(area, p, pevent, NS_PAINT);
|
||||
|
||||
nsWindow *win = (nsWindow *)p;
|
||||
|
||||
win->OnPaint(pevent);
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
gint handle_expose_event(GtkWidget *w, GdkEventExpose *event, gpointer p)
|
||||
{
|
||||
if (event->type == GDK_NO_EXPOSE)
|
||||
|
|
|
@ -26,6 +26,7 @@ class nsIMenuItem;
|
|||
|
||||
gint handle_configure_event(GtkWidget *w, GdkEventConfigure *conf, gpointer p);
|
||||
void handle_size_allocate(GtkWidget *w, GtkAllocation *alloc, gpointer p);
|
||||
gint handle_draw_event(GtkWidget *w, GdkRectangle *area, gpointer p);
|
||||
gint handle_expose_event(GtkWidget *w, GdkEventExpose *event, gpointer p);
|
||||
gint handle_button_press_event(GtkWidget *w, GdkEventButton * event, gpointer p);
|
||||
gint handle_button_release_event(GtkWidget *w, GdkEventButton * event, gpointer p);
|
||||
|
|
|
@ -179,11 +179,7 @@ NS_METHOD nsWidget::Move(PRUint32 aX, PRUint32 aY)
|
|||
mBounds.x = aX;
|
||||
mBounds.y = aY;
|
||||
mMoveEventsPending++;
|
||||
#ifdef USE_GTK_FIXED
|
||||
::gtk_fixed_move(GTK_FIXED(mWidget->parent), mWidget, aX, aY);
|
||||
#else
|
||||
::gtk_layout_move(GTK_LAYOUT(mWidget->parent), mWidget, aX, aY);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -205,6 +201,11 @@ NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
|
|||
::gtk_widget_set_usize(mWidget, aWidth, aHeight);
|
||||
}
|
||||
|
||||
if (aRepaint)
|
||||
if (GTK_WIDGET_VISIBLE (mWidget))
|
||||
::gtk_widget_queue_draw (mWidget);
|
||||
|
||||
/*
|
||||
if (aRepaint && GTK_IS_WIDGET (mWidget) &&
|
||||
GTK_WIDGET_REALIZED (GTK_WIDGET(mWidget))) {
|
||||
|
||||
|
@ -224,6 +225,7 @@ NS_METHOD nsWidget::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepaint)
|
|||
gtk_widget_event (GTK_WIDGET(mWidget), (GdkEvent*) &event);
|
||||
gdk_window_unref (event.window);
|
||||
}
|
||||
*/
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -455,7 +457,6 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
|||
if (gtk_widget_intersect(mWidget, &nRect, &wRect))
|
||||
::gtk_widget_draw(mWidget, &wRect);
|
||||
else
|
||||
if (gtk_widget_intersect(mWidget, &nRect, &wRect))
|
||||
::gtk_widget_queue_draw_area(mWidget,
|
||||
aRect.width, aRect.height,
|
||||
aRect.x, aRect.y);
|
||||
|
@ -465,8 +466,14 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
|
|||
|
||||
NS_METHOD nsWidget::Update(void)
|
||||
{
|
||||
GdkRectangle foo;
|
||||
foo.width = mBounds.width;
|
||||
foo.height = mBounds.height;
|
||||
foo.x = 0;
|
||||
foo.y = 0;
|
||||
|
||||
if (!mIsDestroying) {
|
||||
::gtk_widget_draw(mWidget, NULL);
|
||||
::gtk_widget_draw(mWidget, &foo);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -551,7 +558,6 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
nsNativeWidget aNativeParent)
|
||||
{
|
||||
GtkWidget *parentWidget = nsnull;
|
||||
mBounds = aRect;
|
||||
|
||||
gtk_widget_push_colormap(gdk_rgb_get_cmap());
|
||||
gtk_widget_push_visual(gdk_rgb_get_visual());
|
||||
|
@ -570,9 +576,13 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
}
|
||||
|
||||
CreateNative (parentWidget);
|
||||
gtk_widget_show(mWidget);
|
||||
|
||||
Resize(mBounds.width, mBounds.height, PR_FALSE);
|
||||
|
||||
gtk_widget_set_app_paintable(mWidget, PR_TRUE);
|
||||
|
||||
Resize(aRect.width, aRect.height, PR_FALSE);
|
||||
/* place the widget in its parent */
|
||||
if (parentWidget)
|
||||
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y);
|
||||
|
||||
// connect the size allocate to the
|
||||
gtk_signal_connect(GTK_OBJECT(mWidget),
|
||||
|
@ -580,13 +590,6 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
GTK_SIGNAL_FUNC(handle_size_allocate),
|
||||
this);
|
||||
|
||||
/* place the widget in its parent */
|
||||
if (parentWidget)
|
||||
#ifdef USE_GTK_FIXED
|
||||
gtk_fixed_put(GTK_FIXED(parentWidget), mWidget, mBounds.x, mBounds.y);
|
||||
#else
|
||||
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, mBounds.x, mBounds.y);
|
||||
#endif
|
||||
gtk_widget_pop_colormap();
|
||||
gtk_widget_pop_visual();
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
// #define USE_GTK_FIXED 1
|
||||
|
||||
/**
|
||||
* Base of all GTK+ native widgets.
|
||||
|
|
|
@ -116,10 +116,11 @@ NS_METHOD nsWindow::RemoveTooltips()
|
|||
gint handle_delete_event(GtkWidget *w, GdkEventAny *e, gpointer data)
|
||||
{
|
||||
nsWindow *win = (nsWindow *)data;
|
||||
// win->mIsDestroying = PR_TRUE;
|
||||
/* bug 2503 */
|
||||
/* we need to send the WM_DELETE_WINDOW event. not sure how. */
|
||||
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
NS_METHOD nsWindow::PreCreateWidget(nsWidgetInitData *aInitData)
|
||||
|
@ -152,7 +153,6 @@ NS_METHOD nsWindow::CreateNative(GtkWidget *parentWidget)
|
|||
{
|
||||
mWidget = gtk_layout_new(PR_FALSE, PR_FALSE);
|
||||
GTK_WIDGET_SET_FLAGS(mWidget, GTK_CAN_FOCUS);
|
||||
gtk_widget_set_app_paintable(mWidget, PR_TRUE);
|
||||
|
||||
gtk_widget_set_events (mWidget,
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
|
@ -208,7 +208,7 @@ void nsWindow::InitCallbacks(char * aName)
|
|||
GTK_SIGNAL_FUNC(handle_size_allocate),
|
||||
this);
|
||||
#endif
|
||||
gtk_signal_connect(GTK_OBJECT(mWidget),
|
||||
gtk_signal_connect_after(GTK_OBJECT(mWidget),
|
||||
"button_press_event",
|
||||
GTK_SIGNAL_FUNC(handle_button_press_event),
|
||||
this);
|
||||
|
@ -228,6 +228,10 @@ void nsWindow::InitCallbacks(char * aName)
|
|||
"leave_notify_event",
|
||||
GTK_SIGNAL_FUNC(handle_leave_notify_event),
|
||||
this);
|
||||
gtk_signal_connect(GTK_OBJECT(mWidget),
|
||||
"draw",
|
||||
GTK_SIGNAL_FUNC(handle_draw_event),
|
||||
this);
|
||||
gtk_signal_connect(GTK_OBJECT(mWidget),
|
||||
"expose_event",
|
||||
GTK_SIGNAL_FUNC(handle_expose_event),
|
||||
|
|
Загрузка…
Ссылка в новой задаче