зеркало из https://github.com/mozilla/gecko-dev.git
land SUPERWIN
This commit is contained in:
Родитель
6f07eb8d2c
Коммит
808efc0995
|
@ -22,6 +22,9 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gdksuperwin.h"
|
||||
#include "gtkmozbox.h"
|
||||
|
||||
#include "nsBrowserWindow.h"
|
||||
#include "resources.h"
|
||||
#include "nscore.h"
|
||||
|
@ -148,9 +151,12 @@ void CreateViewerMenus(nsIWidget * aParent,
|
|||
|
||||
GtkItemFactory *item_factory;
|
||||
GtkWidget *menubar;
|
||||
|
||||
GtkWidget *gtkLayout = (GtkWidget*)aParent->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
GdkSuperWin *gdkSuperWin;
|
||||
GtkWidget *mozBox;
|
||||
|
||||
gdkSuperWin = (GdkSuperWin*)aParent->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
int nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]);
|
||||
item_factory = gtk_item_factory_new (GTK_TYPE_MENU_BAR, "<main>", nsnull);
|
||||
|
||||
|
@ -160,10 +166,13 @@ void CreateViewerMenus(nsIWidget * aParent,
|
|||
|
||||
gtk_menu_bar_set_shadow_type (GTK_MENU_BAR(menubar), GTK_SHADOW_NONE);
|
||||
|
||||
NS_ASSERTION(GTK_IS_LAYOUT(gtkLayout),"code assumes a GtkLayout widget.");
|
||||
|
||||
gtk_layout_put(GTK_LAYOUT(gtkLayout),menubar,0,0);
|
||||
NS_ASSERTION(GDK_IS_SUPERWIN(gdkSuperWin), "code assumes a gdksuperwin.");
|
||||
mozBox = gtk_mozbox_new(gdkSuperWin->bin_window);
|
||||
NS_ASSERTION((mozBox != NULL), "failed to create mozBox.");
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mozBox), menubar);
|
||||
gtk_mozbox_set_position(GTK_MOZBOX(mozBox), 0, 0 );
|
||||
gtk_widget_show(mozBox);
|
||||
gtk_widget_show(menubar);
|
||||
|
||||
*aMenuBarOut = menubar;
|
||||
|
|
|
@ -1,22 +1,18 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
|
@ -74,7 +70,7 @@ EXTRA_DSO_LDOPTS = \
|
|||
$(NULL)
|
||||
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_GTK_LDFLAGS)
|
||||
EXTRA_DSO_LDOPTS += -L$(DIST)/lib -lgtksuperwin $(MOZ_GTK_LDFLAGS)
|
||||
else
|
||||
EXTRA_DSO_LDOPTS += $(TK_LIBS)
|
||||
endif
|
||||
|
@ -83,8 +79,10 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
CXXFLAGS += $(MOZ_GTK_CFLAGS)
|
||||
CFLAGS += $(MOZ_GTK_CFLAGS)
|
||||
else
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
CFLAGS += $(TK_CFLAGS)
|
||||
endif
|
||||
|
||||
DEFINES += -D_IMPL_NS_WIDGET -DUSE_XIM
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
#include "nsICmdLineService.h"
|
||||
#include "nsGtkEventHandler.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MOZ_GLE
|
||||
|
@ -302,6 +303,10 @@ NS_IMETHODIMP nsAppShell::Create(int *bac, char **bav)
|
|||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
// It is most convenient for us to intercept our events after
|
||||
// they have been converted to GDK, but before GTK+ gets them
|
||||
gdk_event_handler_set (handle_gdk_event, NULL, NULL);
|
||||
|
||||
#ifdef MOZ_GLE
|
||||
gle_init (&argc, &argv);
|
||||
#endif
|
||||
|
|
|
@ -45,10 +45,31 @@ nsButton::nsButton() : nsWidget() , nsIButton()
|
|||
// Create the native Button widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsButton::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsButton::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
#ifdef USE_SUPERWIN
|
||||
if (!GDK_IS_SUPERWIN(parentWindow)) {
|
||||
g_print("Damn, brother. That's not a superwin.\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
GdkSuperWin *superwin = GDK_SUPERWIN(parentWindow);
|
||||
|
||||
mMozBox = gtk_mozbox_new(superwin->bin_window);
|
||||
|
||||
#endif
|
||||
|
||||
mWidget = gtk_button_new_with_label("");
|
||||
gtk_widget_set_name(mWidget, "nsButton");
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
|
||||
// make sure that we put the scrollbar into the mozbox
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mMozBox), mWidget);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
protected:
|
||||
NS_METHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_METHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
};
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ nsCheckButton::OnDestroySignal(GtkWidget* aGtkWidget)
|
|||
// Create the native CheckButton widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsCheckButton::CreateNative(GtkWidget *parentWindow)
|
||||
NS_METHOD nsCheckButton::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
mWidget = gtk_event_box_new();
|
||||
mCheckButton = gtk_check_button_new();
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
virtual void OnToggledSignal(const gboolean aState);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
|
||||
|
|
|
@ -279,7 +279,7 @@ NS_METHOD nsComboBox::Deselect()
|
|||
// Create the native GtkCombo widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsComboBox::CreateNative(GtkWidget *parentWindow)
|
||||
NS_METHOD nsComboBox::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
mWidget = ::gtk_event_box_new();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
virtual void OnUnmapSignal(GtkWidget* aWidget);
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
#include "nsGtkEventHandler.h"
|
||||
|
||||
#include "nsWidget.h"
|
||||
#include "nsWindow.h"
|
||||
|
||||
|
@ -43,6 +40,9 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_CI
|
|||
#include "stdio.h"
|
||||
#include "ctype.h"
|
||||
|
||||
#include "gtk/gtk.h"
|
||||
#include "nsGtkEventHandler.h"
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
@ -692,7 +692,7 @@ open_unicode_decoder(void) {
|
|||
}
|
||||
|
||||
// GTK's text widget already does XIM, so we don't want to do this again
|
||||
gint handle_key_press_event_for_text(GtkWidget *w, GdkEventKey* event,
|
||||
gint handle_key_press_event_for_text(GtkObject *w, GdkEventKey* event,
|
||||
gpointer p)
|
||||
{
|
||||
nsKeyEvent kevent;
|
||||
|
@ -724,13 +724,16 @@ gint handle_key_press_event_for_text(GtkWidget *w, GdkEventKey* event,
|
|||
win->OnKey(kevent);
|
||||
|
||||
win->Release();
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");
|
||||
if (w)
|
||||
{
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// GTK's text widget already does XIM, so we don't want to do this again
|
||||
gint handle_key_release_event_for_text(GtkWidget *w, GdkEventKey* event,
|
||||
gint handle_key_release_event_for_text(GtkObject *w, GdkEventKey* event,
|
||||
gpointer p)
|
||||
{
|
||||
nsKeyEvent kevent;
|
||||
|
@ -747,15 +750,18 @@ gint handle_key_release_event_for_text(GtkWidget *w, GdkEventKey* event,
|
|||
win->AddRef();
|
||||
win->OnKey(kevent);
|
||||
win->Release();
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_release_event");
|
||||
|
||||
if (w)
|
||||
{
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_release_event");
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//==============================================================
|
||||
gint handle_key_press_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
||||
gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
||||
{
|
||||
nsKeyEvent kevent;
|
||||
nsWindow* win = (nsWindow*)p;
|
||||
|
@ -810,13 +816,16 @@ gint handle_key_press_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
|||
}
|
||||
|
||||
win->Release();
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");
|
||||
|
||||
if (w)
|
||||
{
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_press_event");
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
gint handle_key_release_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
||||
gint handle_key_release_event(GtkObject *w, GdkEventKey* event, gpointer p)
|
||||
{
|
||||
// Don't pass shift, control and alt as key release events
|
||||
if (event->keyval == GDK_Shift_L
|
||||
|
@ -833,11 +842,102 @@ gint handle_key_release_event(GtkWidget *w, GdkEventKey* event, gpointer p)
|
|||
win->OnKey(kevent);
|
||||
win->Release();
|
||||
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_release_event");
|
||||
if (w)
|
||||
{
|
||||
gtk_signal_emit_stop_by_name (GTK_OBJECT(w), "key_release_event");
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void
|
||||
handle_gdk_event (GdkEvent *event, gpointer data)
|
||||
{
|
||||
GtkObject *object = nsnull;
|
||||
|
||||
if (event->any.window)
|
||||
gdk_window_get_user_data (event->any.window, (void **)&object);
|
||||
|
||||
if (object != nsnull &&
|
||||
GDK_IS_SUPERWIN (object))
|
||||
{
|
||||
// It was an event on one of our superwindows
|
||||
|
||||
nsWindow *window = (nsWindow *)gtk_object_get_data (object, "nsWindow");
|
||||
|
||||
if (gtk_grab_get_current () != nsnull)
|
||||
{
|
||||
// A GTK+ grab is in effect. Rewrite the event to point to
|
||||
// our toplevel, and pass it through.
|
||||
// XXX: We should actually translate the coordinates
|
||||
|
||||
gdk_window_unref (event->any.window);
|
||||
event->any.window = GTK_WIDGET (window->GetMozArea())->window;
|
||||
gdk_window_ref (event->any.window);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle it ourselves.
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
case GDK_KEY_PRESS:
|
||||
handle_key_press_event (NULL, &event->key, window);
|
||||
break;
|
||||
case GDK_KEY_RELEASE:
|
||||
handle_key_release_event (NULL, &event->key, window);
|
||||
break;
|
||||
default:
|
||||
window->HandleEvent (event);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_main_do_event (event);
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void
|
||||
handle_xlib_shell_event(GdkSuperWin *superwin, XEvent *event, gpointer p)
|
||||
{
|
||||
nsWindow *window = (nsWindow *)p;
|
||||
switch(event->xany.type) {
|
||||
case ConfigureNotify:
|
||||
window->HandleXlibConfigureNotifyEvent(event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
void
|
||||
handle_xlib_bin_event(GdkSuperWin *superwin, XEvent *event, gpointer p)
|
||||
{
|
||||
nsWindow *window = (nsWindow *)p;
|
||||
|
||||
switch(event->xany.type) {
|
||||
case Expose:
|
||||
window->HandleXlibExposeEvent(event);
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
window->HandleXlibButtonEvent((XButtonEvent *)event);
|
||||
break;
|
||||
case MotionNotify:
|
||||
window->HandleXlibMotionNotifyEvent((XMotionEvent *) event);
|
||||
break;
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
window->HandleXlibCrossingEvent((XCrossingEvent *) event);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================
|
||||
gint nsGtkWidget_FSBCancel_Callback(GtkWidget *w, gpointer p)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#define __nsGtkEventHandler_h
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include "gdksuperwin.h"
|
||||
|
||||
class nsIWidget;
|
||||
class nsIMenuItem;
|
||||
|
@ -34,11 +36,11 @@ void handle_size_allocate(GtkWidget *w, GtkAllocation *alloc, gpointer p);
|
|||
gint handle_expose_event(GtkWidget *w, GdkEventExpose *event, gpointer p);
|
||||
|
||||
|
||||
gint handle_key_release_event_for_text(GtkWidget *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_press_event_for_text(GtkWidget *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_release_event_for_text(GtkObject *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_press_event_for_text(GtkObject *w, GdkEventKey* event, gpointer p);
|
||||
|
||||
gint handle_key_release_event(GtkWidget *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_press_event(GtkWidget *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_release_event(GtkObject *w, GdkEventKey* event, gpointer p);
|
||||
gint handle_key_press_event(GtkObject *w, GdkEventKey* event, gpointer p);
|
||||
|
||||
void handle_scrollbar_value_changed(GtkAdjustment *adjustment, gpointer p);
|
||||
|
||||
|
@ -63,5 +65,8 @@ gint nsGtkWidget_Expose_Callback(GtkWidget *w, gpointer p);
|
|||
|
||||
gint nsGtkWidget_Refresh_Callback(gpointer call_data);
|
||||
|
||||
void handle_xlib_shell_event(GdkSuperWin *superwin, XEvent *event, gpointer p);
|
||||
void handle_xlib_bin_event(GdkSuperWin *superwin, XEvent *event, gpointer p);
|
||||
void handle_gdk_event (GdkEvent *event, gpointer data);
|
||||
|
||||
#endif // __nsGtkEventHandler.h
|
||||
|
|
|
@ -55,7 +55,7 @@ nsLabel::~nsLabel()
|
|||
// Create the nativeLabel widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsLabel::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsLabel::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
unsigned char alignment = GetNativeAlignment();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
|
||||
protected:
|
||||
NS_METHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_METHOD CreateNative(GtkObject *parentWindow);
|
||||
GtkJustification GetNativeAlignment();
|
||||
|
||||
nsLabelAlignment mAlignment;
|
||||
|
|
|
@ -336,7 +336,7 @@ NS_IMETHODIMP nsListBox::PreCreateWidget(nsWidgetInitData *aInitData)
|
|||
// Create the native widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsListBox::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsListBox::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
// to handle scrolling
|
||||
mWidget = gtk_scrolled_window_new (nsnull, nsnull);
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ nsresult nsRadioButton::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
// Create the native RadioButton widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsRadioButton::CreateNative(GtkWidget *parentWindow)
|
||||
NS_METHOD nsRadioButton::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
mWidget = gtk_event_box_new();
|
||||
mRadioButton = gtk_radio_button_new(nsnull);
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
void DisArmed();
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
|
||||
|
|
|
@ -58,10 +58,23 @@ nsScrollbar::~nsScrollbar ()
|
|||
// Create the native scrollbar widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsScrollbar::CreateNative (GtkWidget * parentWindow)
|
||||
NS_IMETHODIMP nsScrollbar::CreateNative (GtkObject * parentWindow)
|
||||
{
|
||||
// Create scrollbar, random default values
|
||||
mAdjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, 100, 1, 25, 25));
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
|
||||
if (!GDK_IS_SUPERWIN(parentWindow)) {
|
||||
g_print("Damn, brother. That's not a superwin.\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
GdkSuperWin *superwin = GDK_SUPERWIN(parentWindow);
|
||||
|
||||
mMozBox = gtk_mozbox_new(superwin->bin_window);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
switch (mOrientation)
|
||||
{
|
||||
|
@ -73,6 +86,14 @@ NS_IMETHODIMP nsScrollbar::CreateNative (GtkWidget * parentWindow)
|
|||
break;
|
||||
}
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
|
||||
// make sure that we put the scrollbar into the mozbox
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mMozBox), mWidget);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
gtk_widget_set_name (mWidget, "nsScrollbar");
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (mAdjustment),
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
virtual PRBool OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
virtual void OnDestroySignal(GtkWidget* aGtkWidget);
|
||||
|
||||
private:
|
||||
|
|
|
@ -55,7 +55,7 @@ nsTextAreaWidget::~nsTextAreaWidget()
|
|||
// Create the native Text widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsTextAreaWidget::CreateNative(GtkWidget *parentWindow)
|
||||
NS_METHOD nsTextAreaWidget::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
PRBool oldIsReadOnly;
|
||||
mWidget = gtk_scrolled_window_new(nsnull, nsnull);
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
virtual void SetFontNative(GdkFont *aFont);
|
||||
|
||||
protected:
|
||||
NS_METHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_METHOD CreateNative(GtkObject *parentWindow);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -59,11 +59,24 @@ nsTextWidget::~nsTextWidget()
|
|||
// Create the native Entry widget
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
NS_IMETHODIMP nsTextWidget::CreateNative(GtkWidget *parentWindow)
|
||||
NS_IMETHODIMP nsTextWidget::CreateNative(GtkObject *parentWindow)
|
||||
{
|
||||
PRBool oldIsReadOnly;
|
||||
mWidget = gtk_entry_new();
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
|
||||
if (!GDK_IS_SUPERWIN(parentWindow)) {
|
||||
g_print("Damn, brother. That's not a superwin.\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
GdkSuperWin *superwin = GDK_SUPERWIN(parentWindow);
|
||||
|
||||
mMozBox = gtk_mozbox_new(superwin->bin_window);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
// used by nsTextHelper because nsTextArea needs a scrolled_window
|
||||
mTextWidget = mWidget;
|
||||
|
||||
|
@ -97,6 +110,14 @@ NS_IMETHODIMP nsTextWidget::CreateNative(GtkWidget *parentWindow)
|
|||
GDK_LEAVE_NOTIFY_MASK |
|
||||
GDK_POINTER_MOTION_MASK);
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
|
||||
// make sure that we put the scrollbar into the mozbox
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mMozBox), mWidget);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
|
||||
PRBool OnKey(nsKeyEvent &aEvent);
|
||||
protected:
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow);
|
||||
};
|
||||
|
||||
#endif // nsTextWidget_h__
|
||||
|
|
|
@ -67,9 +67,9 @@ nsILookAndFeel *nsWidget::sLookAndFeel = nsnull;
|
|||
PRUint32 nsWidget::sWidgetCount = 0;
|
||||
|
||||
|
||||
static nsIRollupListener *gRollupListener = nsnull;
|
||||
static nsIWidget *gRollupWidget = nsnull;
|
||||
static PRBool gRollupConsumeRollupEvent = PR_FALSE;
|
||||
nsIRollupListener *nsWidget::gRollupListener = nsnull;
|
||||
nsIWidget *nsWidget::gRollupWidget = nsnull;
|
||||
PRBool nsWidget::gRollupConsumeRollupEvent = PR_FALSE;
|
||||
|
||||
//
|
||||
// Keep track of the last widget being "dragged"
|
||||
|
@ -116,6 +116,7 @@ nsWidget::nsWidget()
|
|||
|
||||
mGrabTime = 0;
|
||||
mWidget = nsnull;
|
||||
mMozBox = 0;
|
||||
mParent = nsnull;
|
||||
mPreferredWidth = 0;
|
||||
mPreferredHeight = 0;
|
||||
|
@ -146,6 +147,7 @@ nsWidget::nsWidget()
|
|||
mIC = nsnull;
|
||||
mIMECompositionUniString = nsnull;
|
||||
mIMECompositionUniStringSize = 0;
|
||||
mListenForResizes = PR_FALSE;
|
||||
|
||||
}
|
||||
|
||||
|
@ -170,7 +172,6 @@ nsWidget::~nsWidget()
|
|||
delete[] mIMECompositionUniString;
|
||||
mIMECompositionUniString = nsnull;
|
||||
}
|
||||
|
||||
NS_ASSERTION(!ModalWidgetList::Find(mWidget), "destroying widget without first clearing modality.");
|
||||
}
|
||||
|
||||
|
@ -269,7 +270,12 @@ NS_IMETHODIMP nsWidget::Destroy(void)
|
|||
}
|
||||
// prevent the widget from causing additional events
|
||||
mEventCallback = nsnull;
|
||||
#ifdef USE_SUPERWIN
|
||||
// destroying the mozbox will destroy the widget contained in it.
|
||||
::gtk_widget_destroy(mMozBox);
|
||||
#else
|
||||
::gtk_widget_destroy(mWidget);
|
||||
#endif
|
||||
mWidget = nsnull;
|
||||
if (PR_FALSE == mOnDestroyCalled)
|
||||
OnDestroy();
|
||||
|
@ -306,9 +312,10 @@ nsWidget::DestroySignal(GtkWidget* aGtkWidget, nsWidget* aWidget)
|
|||
void
|
||||
nsWidget::SuppressModality(PRBool aSuppress)
|
||||
{
|
||||
ModalWidgetList::Suppress(aSuppress);
|
||||
ModalWidgetList::Suppress(aSuppress);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsWidget::OnDestroySignal(GtkWidget* aGtkWidget)
|
||||
{
|
||||
|
@ -342,11 +349,21 @@ NS_IMETHODIMP nsWidget::Show(PRBool bState)
|
|||
if (!mWidget)
|
||||
return NS_OK; // Will be null durring printing
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
if (bState) {
|
||||
gtk_widget_show(mWidget);
|
||||
gtk_widget_show(mMozBox);
|
||||
}
|
||||
else {
|
||||
gtk_widget_hide(mMozBox);
|
||||
gtk_widget_hide(mWidget);
|
||||
}
|
||||
#else
|
||||
if (bState)
|
||||
gtk_widget_show(mWidget);
|
||||
else
|
||||
gtk_widget_hide(mWidget);
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
mShown = bState;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -355,6 +372,7 @@ NS_IMETHODIMP nsWidget::Show(PRBool bState)
|
|||
|
||||
NS_IMETHODIMP nsWidget::CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent)
|
||||
{
|
||||
#ifndef USE_SUPERWIN
|
||||
#ifdef DEBUG_pavlov
|
||||
printf("nsWindow::CaptureRollupEvents() this = %p , doCapture = %i\n", this, aDoCapture);
|
||||
#endif
|
||||
|
@ -379,15 +397,15 @@ NS_IMETHODIMP nsWidget::CaptureRollupEvents(nsIRollupListener * aListener, PRBoo
|
|||
else
|
||||
{
|
||||
gdk_pointer_grab (GTK_LAYOUT(mWidget)->bin_window, PR_TRUE,(GdkEventMask)
|
||||
(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
|
||||
GDK_POINTER_MOTION_MASK),
|
||||
(GdkWindow*)NULL, cursor, GDK_CURRENT_TIME);
|
||||
(GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
|
||||
GDK_POINTER_MOTION_MASK),
|
||||
(GdkWindow*)NULL, cursor, GDK_CURRENT_TIME);
|
||||
#ifdef DEBUG_pavlov
|
||||
printf("pointer grab returned %i\n", ret);
|
||||
#endif
|
||||
gdk_cursor_destroy(cursor);
|
||||
SuppressModality(PR_TRUE);
|
||||
SuppressModality(PR_FALSE);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -397,7 +415,6 @@ NS_IMETHODIMP nsWidget::CaptureRollupEvents(nsIRollupListener * aListener, PRBoo
|
|||
#endif
|
||||
gdk_pointer_ungrab(GDK_CURRENT_TIME);
|
||||
// gtk_grab_remove(grabWidget);
|
||||
SuppressModality(PR_FALSE);
|
||||
}
|
||||
|
||||
if (aDoCapture) {
|
||||
|
@ -415,11 +432,10 @@ NS_IMETHODIMP nsWidget::CaptureRollupEvents(nsIRollupListener * aListener, PRBoo
|
|||
//gRollupListener = nsnull;
|
||||
NS_IF_RELEASE(gRollupWidget);
|
||||
}
|
||||
|
||||
#endif /* USE_SUPERWIN */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsWidget::SetModal(PRBool aModal)
|
||||
{
|
||||
GtkWidget *topWidget;
|
||||
|
@ -448,7 +464,7 @@ NS_IMETHODIMP nsWidget::SetModal(PRBool aModal)
|
|||
gtk_window_set_modal(topWindow, FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsWidget::IsVisible(PRBool &aState)
|
||||
|
@ -471,6 +487,10 @@ NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
|||
{
|
||||
if (mWidget)
|
||||
{
|
||||
// all hail the nested ifdef
|
||||
#ifdef USE_SUPERWIN
|
||||
gtk_mozbox_set_position(GTK_MOZBOX(mMozBox), aX, aY);
|
||||
#else
|
||||
GtkWidget * layout = mWidget->parent;
|
||||
|
||||
GtkAdjustment* ha = gtk_layout_get_hadjustment(GTK_LAYOUT(layout));
|
||||
|
@ -508,6 +528,7 @@ NS_IMETHODIMP nsWidget::Move(PRInt32 aX, PRInt32 aY)
|
|||
mWidget,
|
||||
aX + x_correction,
|
||||
aY + y_correction);
|
||||
#endif /* USE_SUPERWIN */
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1023,7 +1044,7 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
nsWidgetInitData *aInitData,
|
||||
nsNativeWidget aNativeParent)
|
||||
{
|
||||
GtkWidget *parentWidget = nsnull;
|
||||
GtkObject *parentWidget = nsnull;
|
||||
|
||||
#ifdef NOISY_DESTROY
|
||||
if (aParent)
|
||||
|
@ -1050,10 +1071,12 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
NS_IF_ADDREF(mParent);
|
||||
|
||||
if (aNativeParent) {
|
||||
parentWidget = GTK_WIDGET(aNativeParent);
|
||||
parentWidget = GTK_OBJECT(aNativeParent);
|
||||
// we've got a native parent so listen for resizes
|
||||
mListenForResizes = PR_TRUE;
|
||||
} else if (aParent) {
|
||||
// this ups the refcount of the gtk widget, we must unref later.
|
||||
parentWidget = GTK_WIDGET(aParent->GetNativeData(NS_NATIVE_WIDGET));
|
||||
parentWidget = GTK_OBJECT(aParent->GetNativeData(NS_NATIVE_WIDGET));
|
||||
}
|
||||
|
||||
mBounds = aRect;
|
||||
|
@ -1061,6 +1084,7 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
|
||||
Resize(aRect.width, aRect.height, PR_FALSE);
|
||||
|
||||
#ifndef USE_SUPERWIN
|
||||
/* place the widget in its parent if it isn't a toplevel window*/
|
||||
if (mIsToplevel)
|
||||
{
|
||||
|
@ -1076,10 +1100,15 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
gtk_layout_put(GTK_LAYOUT(parentWidget), mWidget, aRect.x, aRect.y);
|
||||
}
|
||||
}
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
gtk_widget_pop_colormap();
|
||||
gtk_widget_pop_visual();
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
if (mWidget) {
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
InstallButtonPressSignal(mWidget);
|
||||
InstallButtonReleaseSignal(mWidget);
|
||||
|
||||
|
@ -1105,16 +1134,24 @@ nsresult nsWidget::CreateWidget(nsIWidget *aParent,
|
|||
InstallFocusInSignal(mWidget);
|
||||
InstallFocusOutSignal(mWidget);
|
||||
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
}
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
DispatchStandardEvent(NS_CREATE);
|
||||
InitCallbacks();
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
if (mWidget) {
|
||||
#endif /* USE_SUPERWIN */
|
||||
// Add in destroy callback
|
||||
gtk_signal_connect(GTK_OBJECT(mWidget),
|
||||
"destroy",
|
||||
GTK_SIGNAL_FUNC(DestroySignal),
|
||||
this);
|
||||
#ifdef USE_SUPERWIN
|
||||
}
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1201,6 +1238,25 @@ void nsWidget::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint
|
|||
// mLastPoint.y = event.point.y;
|
||||
}
|
||||
|
||||
void
|
||||
nsWidget::HandleEvent(GdkEvent *event)
|
||||
{
|
||||
switch (event->any.type)
|
||||
{
|
||||
case GDK_MOTION_NOTIFY:
|
||||
OnMotionNotifySignal (&event->motion);
|
||||
break;
|
||||
case GDK_BUTTON_PRESS:
|
||||
OnButtonPressSignal (&event->button);
|
||||
break;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
OnButtonReleaseSignal (&event->button);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsWidget::ConvertStatus(nsEventStatus aStatus)
|
||||
{
|
||||
switch(aStatus) {
|
||||
|
@ -1224,12 +1280,6 @@ PRBool nsWidget::DispatchWindowEvent(nsGUIEvent* event)
|
|||
return ConvertStatus(status);
|
||||
}
|
||||
|
||||
PRBool nsWidget::DispatchWindowEvent(nsGUIEvent* event, nsEventStatus &aEventStatus)
|
||||
{
|
||||
DispatchEvent(event, aEventStatus);
|
||||
return ConvertStatus(aEventStatus);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
// Dispatch standard event
|
||||
|
@ -1261,7 +1311,7 @@ PRBool nsWidget::DispatchFocus(nsGUIEvent &aEvent)
|
|||
|
||||
#ifdef NS_DEBUG
|
||||
PRInt32
|
||||
nsWidget::debug_GetRenderXID(GtkWidget * aGtkWidget)
|
||||
nsWidget::debug_GetRenderXID(GtkObject * aGtkWidget)
|
||||
{
|
||||
GdkWindow * renderWindow = GetRenderWindow(aGtkWidget);
|
||||
|
||||
|
@ -1270,9 +1320,25 @@ nsWidget::debug_GetRenderXID(GtkWidget * aGtkWidget)
|
|||
return (PRInt32) xid;
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsWidget::debug_GetRenderXID(GtkWidget * aGtkWidget)
|
||||
{
|
||||
return debug_GetRenderXID(GTK_OBJECT(aGtkWidget));
|
||||
}
|
||||
|
||||
nsCAutoString
|
||||
nsWidget::debug_GetName(GtkObject * aGtkWidget)
|
||||
{
|
||||
if (nsnull != aGtkWidget && GTK_IS_WIDGET(aGtkWidget))
|
||||
return debug_GetName(GTK_WIDGET(aGtkWidget));
|
||||
|
||||
return nsCAutoString("null");
|
||||
}
|
||||
|
||||
nsCAutoString
|
||||
nsWidget::debug_GetName(GtkWidget * aGtkWidget)
|
||||
{
|
||||
|
||||
if (nsnull != aGtkWidget)
|
||||
return nsCAutoString(gtk_widget_get_name(aGtkWidget));
|
||||
|
||||
|
@ -1296,15 +1362,19 @@ NS_IMETHODIMP nsWidget::DispatchEvent(nsGUIEvent *aEvent,
|
|||
NS_ADDREF(aEvent->widget);
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
GtkWidget * gw = (GtkWidget *) aEvent->widget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
|
||||
if (CAPS_LOCK_IS_ON)
|
||||
{
|
||||
debug_DumpEvent(stdout,
|
||||
aEvent->widget,
|
||||
aEvent,
|
||||
debug_GetName(gw),
|
||||
(PRInt32) debug_GetRenderXID(gw));
|
||||
GtkObject *gw;
|
||||
void *nativeWidget = aEvent->widget->GetNativeData(NS_NATIVE_WIDGET);
|
||||
if (nativeWidget) {
|
||||
gw = GTK_OBJECT(nativeWidget);
|
||||
|
||||
if (CAPS_LOCK_IS_ON)
|
||||
{
|
||||
debug_DumpEvent(stdout,
|
||||
aEvent->widget,
|
||||
aEvent,
|
||||
debug_GetName(gw),
|
||||
(PRInt32) debug_GetRenderXID(gw));
|
||||
}
|
||||
}
|
||||
#endif // NS_DEBUG
|
||||
|
||||
|
@ -1836,13 +1906,13 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
|
||||
if (gRollupWidget && gRollupListener)
|
||||
{
|
||||
GtkWidget *rollupWidget = GTK_WIDGET(gRollupWidget->GetNativeData(NS_NATIVE_WIDGET));
|
||||
GdkWindow *rollupWindow = (GdkWindow *)gRollupWidget->GetNativeData(NS_NATIVE_WINDOW);
|
||||
|
||||
gint x, y;
|
||||
gint w, h;
|
||||
gdk_window_get_origin(rollupWidget->window, &x, &y);
|
||||
gdk_window_get_origin(rollupWindow, &x, &y);
|
||||
|
||||
gdk_window_get_size(rollupWidget->window, &w, &h);
|
||||
gdk_window_get_size(rollupWindow, &w, &h);
|
||||
|
||||
|
||||
if (!(aGdkButtonEvent->x_root > x &&
|
||||
|
@ -1851,7 +1921,6 @@ nsWidget::OnButtonPressSignal(GdkEventButton * aGdkButtonEvent)
|
|||
aGdkButtonEvent->y_root < y + h))
|
||||
{
|
||||
gRollupListener->Rollup();
|
||||
printf("rolling up\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2498,21 +2567,24 @@ nsWidget::GetWindowForSetBackground()
|
|||
}
|
||||
|
||||
/* virtual */ GdkWindow *
|
||||
nsWidget::GetRenderWindow(GtkWidget * aGtkWidget)
|
||||
nsWidget::GetRenderWindow(GtkObject * aGtkWidget)
|
||||
{
|
||||
GdkWindow * renderWindow = nsnull;
|
||||
|
||||
if (aGtkWidget)
|
||||
#ifdef USE_SUPERWIN
|
||||
if (GDK_IS_SUPERWIN(aGtkWidget)) {
|
||||
renderWindow = GDK_SUPERWIN(aGtkWidget)->bin_window;
|
||||
}
|
||||
#else
|
||||
if (aGtkWidget && GTK_IS_WIDGET(aGtkWidget))
|
||||
{
|
||||
if (GTK_IS_LAYOUT(aGtkWidget))
|
||||
{
|
||||
if (GTK_IS_LAYOUT(aGtkWidget)) {
|
||||
renderWindow = GTK_LAYOUT(aGtkWidget)->bin_window;
|
||||
}
|
||||
else
|
||||
{
|
||||
renderWindow = aGtkWidget->window;
|
||||
} else {
|
||||
renderWindow = GTK_WIDGET(aGtkWidget)->window;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return renderWindow;
|
||||
}
|
||||
|
@ -2851,4 +2923,3 @@ void ModalWidgetList::Suppress(PRBool aSuppress) {
|
|||
gtk_window_set_modal(window, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,10 @@ class nsIToolkit;
|
|||
|
||||
#include <gdk/gdkprivate.h>
|
||||
|
||||
#include "gtkmozbox.h"
|
||||
|
||||
#define USE_SUPERWIN
|
||||
|
||||
#define NSRECT_TO_GDKRECT(ns,gdk) \
|
||||
PR_BEGIN_MACRO \
|
||||
gdk.x = ns.x; \
|
||||
|
@ -146,6 +150,7 @@ public:
|
|||
|
||||
// Utility functions
|
||||
|
||||
void HandleEvent(GdkEvent *event);
|
||||
PRBool ConvertStatus(nsEventStatus aStatus);
|
||||
PRBool DispatchMouseEvent(nsMouseEvent& aEvent);
|
||||
PRBool DispatchStandardEvent(PRUint32 aMsg);
|
||||
|
@ -159,14 +164,14 @@ public:
|
|||
#endif
|
||||
|
||||
// Return the Gdk window used for rendering
|
||||
virtual GdkWindow * GetRenderWindow(GtkWidget * aGtkWidget);
|
||||
virtual GdkWindow * GetRenderWindow(GtkObject * aGtkWidget);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
virtual void OnDestroy();
|
||||
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWindow) { return NS_OK; }
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWindow) { return NS_OK; }
|
||||
|
||||
nsresult CreateWidget(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
|
@ -179,7 +184,6 @@ protected:
|
|||
|
||||
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event);
|
||||
PRBool DispatchWindowEvent(nsGUIEvent* event, nsEventStatus &aEventStatus);
|
||||
|
||||
// Return the Gdk window whose background should change
|
||||
virtual GdkWindow *GetWindowForSetBackground();
|
||||
|
@ -211,8 +215,10 @@ protected:
|
|||
|
||||
void InstallButtonReleaseSignal(GtkWidget * aWidget);
|
||||
|
||||
virtual
|
||||
void InstallFocusInSignal(GtkWidget * aWidget);
|
||||
|
||||
virtual
|
||||
void InstallFocusOutSignal(GtkWidget * aWidget);
|
||||
|
||||
void InstallRealizeSignal(GtkWidget * aWidget);
|
||||
|
@ -267,7 +273,7 @@ public:
|
|||
|
||||
|
||||
|
||||
private:
|
||||
protected:
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -354,12 +360,17 @@ protected:
|
|||
PRUint32 aEventType);
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCAutoString debug_GetName(GtkObject * aGtkWidget);
|
||||
nsCAutoString debug_GetName(GtkWidget * aGtkWidget);
|
||||
PRInt32 debug_GetRenderXID(GtkObject * aGtkWidget);
|
||||
PRInt32 debug_GetRenderXID(GtkWidget * aGtkWidget);
|
||||
#endif
|
||||
|
||||
guint32 mGrabTime;
|
||||
GtkWidget *mWidget;
|
||||
// our mozbox for those native widgets
|
||||
GtkWidget *mMozBox;
|
||||
|
||||
nsIWidget *mParent;
|
||||
|
||||
// This is the composite update area (union of all the calls to
|
||||
|
@ -369,13 +380,17 @@ protected:
|
|||
PRBool mShown;
|
||||
|
||||
PRUint32 mPreferredWidth, mPreferredHeight;
|
||||
PRBool mListenForResizes;
|
||||
|
||||
GdkICPrivate *mIC;
|
||||
GdkICPrivate *GetXIC();
|
||||
void SetXIC(GdkICPrivate *aIC);
|
||||
void GetXYFromPosition(unsigned long *aX, unsigned long *aY);
|
||||
|
||||
|
||||
// this is the rollup listener variables
|
||||
static nsIRollupListener *gRollupListener;
|
||||
static nsIWidget *gRollupWidget;
|
||||
static PRBool gRollupConsumeRollupEvent;
|
||||
|
||||
private:
|
||||
PRBool mIsDragDest;
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -30,6 +30,9 @@
|
|||
|
||||
#include "nsString.h"
|
||||
|
||||
#include "gtkmozarea.h"
|
||||
#include "gdksuperwin.h"
|
||||
|
||||
class nsFont;
|
||||
class nsIAppShell;
|
||||
|
||||
|
@ -69,6 +72,28 @@ public:
|
|||
NS_IMETHOD EndResizingChildren(void);
|
||||
NS_IMETHOD Destroy(void);
|
||||
|
||||
#ifdef USE_SUPERWIN
|
||||
NS_IMETHOD GetAbsoluteBounds(nsRect &aRect);
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener,
|
||||
PRBool aDoCapture,
|
||||
PRBool aConsumeRollupEvent);
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous);
|
||||
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor);
|
||||
NS_IMETHOD SetFocus(void);
|
||||
void QueueDraw();
|
||||
void UnqueueDraw();
|
||||
void DoPaint(PRInt32 x, PRInt32 y, PRInt32 width, PRInt32 height,
|
||||
nsIRegion *aClipRegion);
|
||||
static gboolean UpdateIdle (gpointer data);
|
||||
NS_IMETHOD Update(void);
|
||||
virtual void OnFocusInSignal(GdkEventFocus * aGdkFocusEvent);
|
||||
virtual void OnFocusOutSignal(GdkEventFocus * aGdkFocusEvent);
|
||||
virtual void InstallFocusInSignal(GtkWidget * aWidget);
|
||||
virtual void InstallFocusOutSignal(GtkWidget * aWidget);
|
||||
#endif /* USE_SUPERWIN */
|
||||
|
||||
gint ConvertBorderStyles(nsBorderStyle bs);
|
||||
|
||||
// Add an XATOM property to this window.
|
||||
|
@ -92,8 +117,22 @@ public:
|
|||
virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos);
|
||||
// in nsWidget now
|
||||
// virtual PRBool OnResize(nsSizeEvent &aEvent);
|
||||
|
||||
static void SuperWinFilter(GdkSuperWin *superwin, XEvent *event, gpointer p);
|
||||
|
||||
void HandleXlibExposeEvent(XEvent *event);
|
||||
void HandleXlibConfigureNotifyEvent(XEvent *event);
|
||||
void HandleXlibButtonEvent(XButtonEvent *aButtonEvent);
|
||||
void HandleXlibMotionNotifyEvent(XMotionEvent *aMotionEvent);
|
||||
void HandleXlibCrossingEvent(XCrossingEvent * aCrossingEvent);
|
||||
|
||||
// Return the GtkMozArea that is the nearest parent of this widget
|
||||
GtkWidget *GetMozArea();
|
||||
|
||||
|
||||
// Return the Gdk window used for rendering
|
||||
virtual GdkWindow * GetRenderWindow(GtkObject * aGtkWidget);
|
||||
// XXX Chris - fix these
|
||||
// virtual void OnButtonPressSignal(GdkEventButton * aGdkButtonEvent);
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -122,7 +161,7 @@ protected:
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual void InitCallbacks(char * aName = nsnull);
|
||||
NS_IMETHOD CreateNative(GtkWidget *parentWidget);
|
||||
NS_IMETHOD CreateNative(GtkObject *parentWidget);
|
||||
|
||||
nsIFontMetrics *mFontMetrics;
|
||||
PRBool mVisible;
|
||||
|
@ -139,12 +178,21 @@ protected:
|
|||
PRBool mLowerLeft;
|
||||
|
||||
GtkWidget *mShell; /* used for toplevel windows */
|
||||
|
||||
GdkSuperWin *mSuperWin;
|
||||
GtkWidget *mMozArea;
|
||||
GtkWidget *mMozAreaClosestParent;
|
||||
|
||||
nsIMenuBar *mMenuBar;
|
||||
private:
|
||||
nsresult SetIcon(GdkPixmap *window_pixmap,
|
||||
GdkBitmap *window_mask);
|
||||
nsresult SetIcon();
|
||||
PRBool mIsUpdating;
|
||||
// this is the current GdkSuperWin with the focus
|
||||
static nsWindow *focusWindow;
|
||||
// when this is PR_TRUE we will block focus
|
||||
// events to prevent recursion
|
||||
PRBool mBlockFocusEvents;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -155,7 +203,9 @@ public:
|
|||
ChildWindow();
|
||||
~ChildWindow();
|
||||
virtual PRBool IsChild() const;
|
||||
#ifndef USE_SUPERWIN
|
||||
NS_IMETHOD Destroy(void);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // Window_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче