提交 6c555dae 编写于 作者: L lana

Merge

......@@ -433,6 +433,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_GtkFileDialogPeer_run;
Java_sun_awt_X11_GtkFileDialogPeer_quit;
Java_sun_awt_X11_GtkFileDialogPeer_toFront;
Java_sun_awt_X11_GtkFileDialogPeer_setBounds;
Java_sun_print_CUPSPrinter_initIDs;
Java_sun_print_CUPSPrinter_getCupsServer;
......
......@@ -535,7 +535,14 @@ public class PlatformLogger {
}
void doLog(int level, String msg, Object... params) {
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
// only pass String objects to the j.u.l.Logger which may
// be created by untrusted code
int len = (params != null) ? params.length : 0;
Object[] sparams = new String[len];
for (int i = 0; i < len; i++) {
sparams [i] = String.valueOf(params[i]);
}
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, sparams);
}
boolean isEnabled() {
......
......@@ -56,12 +56,14 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
}
private native void run(String title, int mode, String dir, String file,
FilenameFilter filter, boolean isMultipleMode);
FilenameFilter filter, boolean isMultipleMode, int x, int y);
private native void quit();
@Override
public native void toFront();
@Override
public native void setBounds(int x, int y, int width, int height, int op);
/**
* Called exclusively by the native C code.
......@@ -106,9 +108,8 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
Thread t = new Thread() {
public void run() {
GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(),
fd.getDirectory(), fd.getFile(), fd
.getFilenameFilter(), fd
.isMultipleMode());
fd.getDirectory(), fd.getFile(), fd.getFilenameFilter(), fd.isMultipleMode(),
fd.getX(), fd.getY());
fd.setVisible(false);
}
};
......
......@@ -608,7 +608,10 @@ gboolean gtk2_load()
fp_gtk_viewport_new = dl_symbol("gtk_viewport_new");
fp_gtk_window_new = dl_symbol("gtk_window_new");
fp_gtk_window_present = dl_symbol("gtk_window_present");
fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
fp_gtk_window_move = dl_symbol("gtk_window_move");
fp_gtk_window_resize = dl_symbol("gtk_window_resize");
fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
fp_gtk_frame_new = dl_symbol("gtk_frame_new");
fp_gtk_adjustment_new = dl_symbol("gtk_adjustment_new");
......
......@@ -750,7 +750,8 @@ int (*fp_gdk_pixbuf_get_width)(const GdkPixbuf *pixbuf);
GdkPixbuf *(*fp_gdk_pixbuf_new_from_file)(const char *filename, GError **error);
void (*fp_gtk_widget_destroy)(GtkWidget *widget);
void (*fp_gtk_window_present)(GtkWindow *window);
void (*fp_gtk_window_move)(GtkWindow *window, gint x, gint y);
void (*fp_gtk_window_resize)(GtkWindow *window, gint width, gint height);
/**
* Function Pointers for GtkFileChooser
......
......@@ -102,6 +102,33 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
fp_gdk_threads_leave();
}
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: setBounds
* Signature: (IIIII)V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
(JNIEnv * env, jobject jpeer, jint x, jint y, jint width, jint height, jint op)
{
GtkWindow* dialog;
fp_gdk_threads_enter();
dialog = (GtkWindow*)jlong_to_ptr(
(*env)->GetLongField(env, jpeer, widgetFieldID));
if (dialog != NULL) {
if (x >= 0 && y >= 0) {
fp_gtk_window_move(dialog, (gint)x, (gint)y);
}
if (width > 0 && height > 0) {
fp_gtk_window_resize(dialog, (gint)width, (gint)height);
}
}
fp_gdk_threads_leave();
}
/**
* Convert a GSList to an array of filenames (without the parent folder)
*/
......@@ -175,12 +202,12 @@ static void handle_response(GtkWidget* aDialog, gint responseId, gpointer obj)
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: run
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;Z;)V
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;ZII)V
*/
JNIEXPORT void JNICALL
Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
jstring jtitle, jint mode, jstring jdir, jstring jfile,
jobject jfilter, jboolean multiple)
jobject jfilter, jboolean multiple, int x, int y)
{
GtkWidget *dialog = NULL;
GtkFileFilter *filter;
......@@ -244,6 +271,14 @@ Java_sun_awt_X11_GtkFileDialogPeer_run(JNIEnv * env, jobject jpeer,
dialog), TRUE);
}
/* Set the initial location */
if (x >= 0 && y >= 0) {
fp_gtk_window_move((GtkWindow*)dialog, (gint)x, (gint)y);
// NOTE: it doesn't set the initial size for the file chooser
// as it seems like the file chooser overrides the size internally
}
fp_g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(
handle_response), jpeer);
......
......@@ -20,10 +20,10 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_initIDs
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: run
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;Z;)V
* Signature: (Ljava/lang/String;ILjava/lang/String;Ljava/lang/String;Ljava/io/FilenameFilter;ZII)V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_run
(JNIEnv *, jobject, jstring, jint, jstring, jstring, jobject, jboolean);
(JNIEnv *, jobject, jstring, jint, jstring, jstring, jobject, jboolean, jint, jint);
/*
* Class: sun_awt_X11_GtkFileDialogPeer
......@@ -41,6 +41,14 @@ JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_quit
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_toFront
(JNIEnv *, jobject);
/*
* Class: sun_awt_X11_GtkFileDialogPeer
* Method: setBounds
* Signature: (IIIII)V
*/
JNIEXPORT void JNICALL Java_sun_awt_X11_GtkFileDialogPeer_setBounds
(JNIEnv * env, jobject jpeer, jint x, jint y, jint width, jint height, jint op);
#ifdef __cplusplus
}
#endif
......
......@@ -109,7 +109,6 @@ AwtFrame::AwtFrame() {
m_isMenuDropped = FALSE;
m_isInputMethodWindow = FALSE;
m_isUndecorated = FALSE;
m_proxyFocusOwner = NULL;
m_lastProxiedFocusOwner = NULL;
m_actualFocusedWindow = NULL;
m_iconic = FALSE;
......@@ -127,7 +126,6 @@ AwtFrame::~AwtFrame()
void AwtFrame::Dispose()
{
DestroyProxyFocusOwner();
AwtWindow::Dispose();
}
......@@ -308,22 +306,9 @@ done:
return frame;
}
LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam)
LRESULT AwtFrame::ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, MsgRouting &mr)
{
TRY;
DASSERT(::IsWindow(hwnd));
AwtFrame *parent = (AwtFrame *)
AwtComponent::GetComponentImpl(::GetParent(hwnd));
if (!parent || parent->GetProxyFocusOwner() != hwnd ||
message == AwtComponent::WmAwtIsComponent ||
message == WM_GETOBJECT)
{
return ComCtl32Util::GetInstance().DefWindowProc(NULL, hwnd, message, wParam, lParam);
}
LRESULT retValue = 0L;
AwtComponent *focusOwner = NULL;
// IME and input language related messages need to be sent to a window
......@@ -346,19 +331,23 @@ LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
// TODO: when a Choice's list is dropped down and we're scrolling in
// the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
case WM_MOUSEWHEEL:
focusOwner = AwtComponent::GetComponent(parent->GetLastProxiedFocusOwner());
if (focusOwner != NULL) {
return focusOwner->WindowProc(message, wParam, lParam);
focusOwner = AwtComponent::GetComponent(GetLastProxiedFocusOwner());
if (focusOwner != NULL &&
focusOwner != this) // avoid recursive calls
{
retValue = focusOwner->WindowProc(message, wParam, lParam);
mr = mrConsume;
}
break;
case WM_SETFOCUS:
if (!sm_suppressFocusAndActivation && parent->IsEmbeddedFrame()) {
parent->AwtSetActiveWindow();
if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
AwtSetActiveWindow();
}
return 0;
mr = mrConsume;
break;
case WM_KILLFOCUS:
if (!sm_suppressFocusAndActivation && parent->IsEmbeddedFrame()) {
AwtWindow::SynthesizeWmActivate(FALSE, parent->GetHWnd(), NULL);
if (!sm_suppressFocusAndActivation && IsEmbeddedFrame()) {
AwtWindow::SynthesizeWmActivate(FALSE, GetHWnd(), NULL);
} else if (sm_restoreFocusAndActivation) {
if (AwtComponent::GetFocusedWindow() != NULL) {
......@@ -369,64 +358,28 @@ LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
}
}
}
return 0;
mr = mrConsume;
break;
case 0x0127: // WM_CHANGEUISTATE
case 0x0128: // WM_UPDATEUISTATE
return 0;
mr = mrConsume;
break;
}
return parent->WindowProc(message, wParam, lParam);
CATCH_BAD_ALLOC_RET(0);
return retValue;
}
void AwtFrame::CreateProxyFocusOwner()
LRESULT AwtFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (AwtToolkit::IsMainThread()) {
AwtFrame::_CreateProxyFocusOwner((void *)this);
} else {
AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_CreateProxyFocusOwner, (void *)this);
}
}
void AwtFrame::_CreateProxyFocusOwner(void *param)
{
DASSERT(AwtToolkit::IsMainThread());
AwtFrame *f = (AwtFrame *)param;
DASSERT(f->m_proxyFocusOwner == NULL);
f->m_proxyFocusOwner = ::CreateWindow(TEXT("STATIC"),
TEXT("ProxyFocusOwner"),
WS_CHILD,
0, 0, 0, 0, f->GetHWnd(), NULL,
AwtToolkit::GetInstance().
GetModuleHandle(),
NULL);
f->m_proxyDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(f->m_proxyFocusOwner, ProxyWindowProc);
}
MsgRouting mr = mrDoDefault;
LRESULT retValue = 0L;
void AwtFrame::DestroyProxyFocusOwner()
{
// proxy focus owner must be destroyed on toolkit thread only
if (AwtToolkit::IsMainThread()) {
AwtFrame::_DestroyProxyFocusOwner((void *)this);
} else {
AwtToolkit::GetInstance().InvokeFunction(AwtFrame::_DestroyProxyFocusOwner, (void *)this);
}
}
retValue = ProxyWindowProc(message, wParam, lParam, mr);
void AwtFrame::_DestroyProxyFocusOwner(void *param)
{
DASSERT(AwtToolkit::IsMainThread());
AwtFrame *f = (AwtFrame *)param;
if (f->m_proxyFocusOwner != NULL) {
HWND toDestroy = f->m_proxyFocusOwner;
f->m_proxyFocusOwner = NULL;
ComCtl32Util::GetInstance().UnsubclassHWND(toDestroy, ProxyWindowProc, f->m_proxyDefWindowProc);
::DestroyWindow(toDestroy);
if (mr != mrConsume) {
retValue = AwtWindow::WindowProc(message, wParam, lParam);
}
return retValue;
}
MsgRouting AwtFrame::WmShowWindow(BOOL show, UINT status)
......
......@@ -96,6 +96,8 @@ public:
AwtMenuBar* GetMenuBar();
void SetMenuBar(AwtMenuBar*);
virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
MsgRouting WmGetMinMaxInfo(LPMINMAXINFO lpmmi);
MsgRouting WmSize(UINT type, int w, int h);
MsgRouting WmActivate(UINT nState, BOOL fMinimized, HWND opposite);
......@@ -117,10 +119,7 @@ public:
INLINE BOOL IsUndecorated() { return m_isUndecorated; }
INLINE HWND GetProxyFocusOwner() {
if (m_proxyFocusOwner == NULL) {
CreateProxyFocusOwner();
}
return m_proxyFocusOwner;
return GetHWnd();
}
void SetMaximizedBounds(int x, int y, int w, int h);
......@@ -159,15 +158,7 @@ protected:
BOOL m_isUndecorated;
private:
static LRESULT CALLBACK ProxyWindowProc(HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam);
void CreateProxyFocusOwner();
void DestroyProxyFocusOwner();
/* creates proxy focus owner, called on Toolkit thread */
static void _CreateProxyFocusOwner(void *param);
/* destroys proxy focus owner, called on Toolkit thread */
static void _DestroyProxyFocusOwner(void *param);
LRESULT ProxyWindowProc(UINT message, WPARAM wParam, LPARAM lParam, MsgRouting &mr);
/* The frame's embedding parent (if any) */
HWND m_parentWnd;
......@@ -188,10 +179,6 @@ private:
/* The frame is an InputMethodWindow */
BOOL m_isInputMethodWindow;
/* Receives all keyboard input when an AwtWindow which is not an AwtFrame
or an AwtDialog (or one of its children) has the logical input focus. */
HWND m_proxyFocusOwner;
/* Retains the last/current sm_focusOwner proxied. Actually, it should be
* a component of an owned window last/currently active. */
HWND m_lastProxiedFocusOwner;
......
......@@ -200,10 +200,9 @@ void AwtTrayIcon::InitNID(UINT uID)
m_nid.cbSize = (BYTE *)(&m_nid.guidItem) - (BYTE *)(&m_nid.cbSize);
break;
case 6: // WIN_XP
// Uncomment these two lines when moving to VS2008
// m_nid.cbSize = (BYTE *)(&m_nid.hBalloonIcon) - (BYTE *)(&m_nid.cbSize);
// break;
default: // WIN_VISTA?
m_nid.cbSize = (BYTE *)(&m_nid.hBalloonIcon) - (BYTE *)(&m_nid.cbSize);
break;
default: // WIN_VISTA
m_nid.cbSize = sizeof(m_nid);
break;
}
......
......@@ -221,6 +221,8 @@ AwtWindow::AwtWindow() {
m_windowType = NORMAL;
m_alwaysOnTop = false;
fullScreenExclusiveModeState = FALSE;
}
AwtWindow::~AwtWindow()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册