зеркало из https://github.com/mozilla/pjs.git
Updating xlib. Not part of the build
This commit is contained in:
Родитель
91ce48af5a
Коммит
bc78d67f22
|
@ -0,0 +1,61 @@
|
|||
#
|
||||
# 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 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 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): Rusty Lynch (rusty.lynch@intel.com)
|
||||
#
|
||||
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = xlibxtbin
|
||||
LIBRARY_NAME = xlibxtbin
|
||||
|
||||
REQUIRES = xlibxtbin
|
||||
|
||||
CPPSRCS = \
|
||||
xlibxtbin.cpp \
|
||||
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_XLIB_LDFLAGS) -L/usr/X11R6/lib -lXt
|
||||
else
|
||||
EXTRA_DSO_LDOPTS += $(TK_LIBS) -L/usr/X11R6/lib -lXt
|
||||
endif
|
||||
|
||||
EXPORTS = xlibxtbin.h
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifndef MOZ_MONOLITHIC_TOOLKIT
|
||||
CFLAGS += $(MOZ_XLIB_CFLAGS)
|
||||
else
|
||||
CFLAGS += $(TK_CFLAGS)
|
||||
endif
|
||||
|
||||
DEFINES += -D_IMPL_NS_WIDGET -DUSE_XIM
|
||||
|
||||
# ifeq ($(OS_ARCH), Linux)
|
||||
# DEFINES += -D_BSD_SOURCE
|
||||
# endif
|
||||
|
||||
INCLUDES += \
|
||||
-I$(srcdir) \
|
||||
$(NULL)
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
/* widget -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* XlibXtBin Implementation
|
||||
* Peter Hartshorn
|
||||
* Based on GtkXtBin by Rusty Lynch - 02/27/2000
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "xlibxtbin.h"
|
||||
#include "xlibrgb.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Shell.h>
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/StringDefs.h>
|
||||
|
||||
xtbin::xtbin() {
|
||||
initialized = 0;
|
||||
xtwindow = 0;
|
||||
}
|
||||
|
||||
xtbin::~xtbin() {
|
||||
}
|
||||
|
||||
void xtbin::xtbin_init() {
|
||||
initialized = 1;
|
||||
app_context = XtDisplayToApplicationContext(xlib_rgb_get_display());
|
||||
xtdisplay = xlib_rgb_get_display();
|
||||
}
|
||||
|
||||
void xtbin::xtbin_realize() {
|
||||
Arg args[2];
|
||||
int n;
|
||||
Widget top_widget;
|
||||
Widget embeded;
|
||||
XSetWindowAttributes attr;
|
||||
unsigned long mask;
|
||||
|
||||
attr.bit_gravity = NorthWestGravity;
|
||||
attr.event_mask = ButtonMotionMask |
|
||||
ButtonPressMask |
|
||||
ButtonReleaseMask |
|
||||
EnterWindowMask |
|
||||
ExposureMask |
|
||||
KeyPressMask |
|
||||
KeyReleaseMask |
|
||||
LeaveWindowMask |
|
||||
PointerMotionMask |
|
||||
StructureNotifyMask |
|
||||
VisibilityChangeMask |
|
||||
FocusChangeMask;
|
||||
|
||||
mask = CWBitGravity | CWEventMask;
|
||||
|
||||
window = XCreateWindow(xlib_rgb_get_display(), parent_window,
|
||||
x, y, width, height, 0, CopyFromParent,
|
||||
CopyFromParent, CopyFromParent,
|
||||
mask, &attr);
|
||||
|
||||
XSelectInput(xlib_rgb_get_display(), window, ExposureMask);
|
||||
|
||||
XMapWindow(xlib_rgb_get_display(), window);
|
||||
XFlush(xlib_rgb_get_display());
|
||||
|
||||
top_widget = XtAppCreateShell("drawingArea", "Wrapper",
|
||||
applicationShellWidgetClass, xtdisplay,
|
||||
NULL, 0);
|
||||
|
||||
xtwidget = top_widget;
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XtNheight, height); n++;
|
||||
XtSetArg(args[n], XtNwidth, width); n++;
|
||||
XtSetValues(top_widget, args, n);
|
||||
|
||||
embeded = XtVaCreateWidget("form", compositeWidgetClass, top_widget, NULL);
|
||||
|
||||
n = 0;
|
||||
XtSetArg(args[n], XtNheight, height); n++;
|
||||
XtSetArg(args[n], XtNwidth, width); n++;
|
||||
XtSetValues(embeded, args, n);
|
||||
|
||||
oldwindow = top_widget->core.window;
|
||||
top_widget->core.window = window;
|
||||
|
||||
XtRegisterDrawable(xtdisplay, window, top_widget);
|
||||
|
||||
XtRealizeWidget(embeded);
|
||||
XtRealizeWidget(top_widget);
|
||||
XtManageChild(embeded);
|
||||
|
||||
xtwindow = XtWindow(embeded);
|
||||
|
||||
XSelectInput(xtdisplay, XtWindow(top_widget), 0x0fffff);
|
||||
XSelectInput(xtdisplay, XtWindow(embeded), 0x0fffff);
|
||||
|
||||
XFlush(xtdisplay);
|
||||
|
||||
}
|
||||
|
||||
void xtbin::xtbin_new(Window aParent) {
|
||||
parent_window = aParent;
|
||||
}
|
||||
|
||||
void xtbin::xtbin_destroy() {
|
||||
XtDestroyWidget(xtwidget);
|
||||
initialized = 0;
|
||||
}
|
||||
|
||||
void xtbin::xtbin_resize(int aX, int aY, int aWidth, int aHeight) {
|
||||
x = aX;
|
||||
y = aY;
|
||||
width = aWidth;
|
||||
height = aHeight;
|
||||
}
|
||||
|
||||
int xtbin::xtbin_initialized() {
|
||||
return initialized;
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __XLIB_XTBIN_H__
|
||||
#define __XLIB_XTBIN_H__
|
||||
|
||||
#include <X11/Intrinsic.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/X.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct _XtTMRec {
|
||||
XtTranslations translations; /* private to Translation Manager */
|
||||
XtBoundActions proc_table; /* procedure bindings for actions */
|
||||
struct _XtStateRec *current_state; /* Translation Manager state ptr */
|
||||
unsigned long lastEventTime;
|
||||
} XtTMRec, *XtTM;
|
||||
|
||||
typedef struct _CorePart {
|
||||
Widget self; /* pointer to widget itself */
|
||||
WidgetClass widget_class; /* pointer to Widget's ClassRec */
|
||||
Widget parent; /* parent widget */
|
||||
XrmName xrm_name; /* widget resource name quarkified */
|
||||
Boolean being_destroyed; /* marked for destroy */
|
||||
XtCallbackList destroy_callbacks; /* who to call when widget destroyed */
|
||||
XtPointer constraints; /* constraint record */
|
||||
Position x, y; /* window position */
|
||||
Dimension width, height; /* window dimensions */
|
||||
Dimension border_width; /* window border width */
|
||||
Boolean managed; /* is widget geometry managed? */
|
||||
Boolean sensitive; /* is widget sensitive to user events*/
|
||||
Boolean ancestor_sensitive; /* are all ancestors sensitive? */
|
||||
XtEventTable event_table; /* private to event dispatcher */
|
||||
XtTMRec tm; /* translation management */
|
||||
XtTranslations accelerators; /* accelerator translations */
|
||||
Pixel border_pixel; /* window border pixel */
|
||||
Pixmap border_pixmap; /* window border pixmap or NULL */
|
||||
WidgetList popup_list; /* list of popups */
|
||||
Cardinal num_popups; /* how many popups */
|
||||
String name; /* widget resource name */
|
||||
Screen *screen; /* window's screen */
|
||||
Colormap colormap; /* colormap */
|
||||
Window window; /* window ID */
|
||||
Cardinal depth; /* number of planes in window */
|
||||
Pixel background_pixel; /* window background pixel */
|
||||
Pixmap background_pixmap; /* window background pixmap or NULL */
|
||||
Boolean visible; /* is window mapped and not occluded?*/
|
||||
Boolean mapped_when_managed;/* map window if it's managed? */
|
||||
} CorePart;
|
||||
|
||||
typedef struct _WidgetRec {
|
||||
CorePart core;
|
||||
} WidgetRec, CoreRec;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
class xtbin {
|
||||
public:
|
||||
xtbin();
|
||||
~xtbin();
|
||||
|
||||
void xtbin_init();
|
||||
void xtbin_realize();
|
||||
void xtbin_new(Window aParent);
|
||||
void xtbin_destroy();
|
||||
void xtbin_resize(int aX, int aY, int aWidth, int aHeight);
|
||||
Window xtbin_xtwindow() { return xtwindow; }
|
||||
int xtbin_initialized();
|
||||
|
||||
private:
|
||||
int initialized;
|
||||
Display *xtdisplay;
|
||||
Window xtwindow;
|
||||
XtAppContext app_context;
|
||||
Window parent_window;
|
||||
Widget xtwidget;
|
||||
Window window;
|
||||
Window oldwindow;
|
||||
int x, y, width, height;
|
||||
};
|
||||
|
||||
|
||||
#endif /* __XLIB_XTBIN_H__ */
|
||||
|
Загрузка…
Ссылка в новой задаче