1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-03 14:55:46 +01:00

- Fixed focus handling for windows that set WM_HINTS.take_focus = False.

- Misc fixes.
- Improved a bit the python wrapper.
- Build po files before 'make install'
This commit is contained in:
dan
2002-12-20 17:47:31 +00:00
parent 55d37178a0
commit 064f79ebae
17 changed files with 225 additions and 203 deletions

View File

@@ -51,6 +51,7 @@ Changes since wmaker 0.80.1:
only a reference to the internal color, which you shouldn't release
- Added wstrndup()
- Added WMGetFontName()
- Added fontpanel callback
Changes since wmaker 0.80.0:

View File

@@ -4,7 +4,7 @@ CATALOGS = @WINGSMOFILES@
CLEANFILES = $(CATALOGS) WINGs.pot
EXTRA_DIST = cs.po de.po sk.po fr.po
EXTRA_DIST = cs.po de.po fr.po sk.po
POTFILES = \
$(top_builddir)/WINGs/connection.c \
@@ -27,6 +27,8 @@ SUFFIXES = .po .mo
msgfmt -o $@ $<
all-local: $(CATALOGS)
WINGs.pot: $(POTFILES)
xgettext --default-domain=WINGs \
--add-comments --keyword=_ $(POTFILES)

View File

@@ -1,7 +1,7 @@
all: WINGs.c
python setup.py build
ln -s `find build/ -name wings.so` .
ln -sf `find build/ -name wings.so` .
install: WINGs.c
python setup.py install

View File

@@ -28,7 +28,7 @@
return NULL;
}
}
// This cleans up the char ** array we mallocd before the function call
// This cleans up the char ** array we malloc-ed before the function call
%typemap(python, freearg) char ** {
wfree($1);
}
@@ -95,7 +95,7 @@
$1 = PyFile_AsFile($input);
}
/* These are for freeing the return of functions that need to be freed
/* These are for free-ing the return of functions that need to be freed
* before returning control to python. */
%typemap(python, ret) char* WMGetTextFieldText { wfree($1); };
@@ -173,6 +173,7 @@
//%rename WMScreenMainLoop _WMScreenMainLoop;
//%rename(_WMScreenMainLoop) WMScreenMainLoop;
//%rename WMRunModalLoop _WMRunModalLoop;
@@ -529,14 +530,34 @@
%}
/* ignore structures we will not use */
%ignore ConnectionDelegate;
/* ignore functions we don't need */
// should we ignore vararg functions, or just convert them to functions with
// a fixed number of parameters?
%varargs(char*) wmessage;
//%ignore wmessage;
%ignore wwarning;
%ignore wfatal;
%ignore wsyserror;
%ignore wsyserrorwithcode;
%ignore WMCreatePLArray;
%ignore WMCreatePLDictionary;
%apply int *INPUT { int *argc };
#define Bool int
%include "WINGs/WUtil.h"
/* ignore structures we will not use */
/* ignore functions we don't need */
%include "WINGs/WINGs.h"
%{
void
WHandleEvents()
@@ -558,6 +579,7 @@ WHandleEvents()
}
%}
/* rewrite functions originally defined as macros */
%inline %{
#undef WMDuplicateArray

View File

@@ -2,23 +2,27 @@
import sys
import wings
import exceptions
from exceptions import Exception, StandardError
from types import *
# Some useful constants
False = 0
True = 1
# check about None as action for buttonAction/windowCloseAction ...
################################################################################
# Exceptions
################################################################################
class Error(exceptions.Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
__repr__ = __str__
class Error(StandardError):
pass
del Exception, StandardError
class WMTimer:
def __init__(self, milliseconds, callback, cdata=None, persistent=0):
def __init__(self, milliseconds, callback, cdata=None, persistent=False):
if persistent:
self._o = wings.pyWMAddPersistentTimerHandler(milliseconds, (callback, cdata))
else:
@@ -30,15 +34,17 @@ class WMTimer:
class WMPersistentTimer(WMTimer):
def __init__(self, milliseconds, callback, cdata=None):
WMTimer.__init__(self, milliseconds, callback, cdata, persistent=1)
WMTimer.__init__(self, milliseconds, callback, cdata, persistent=True)
class WMScreen:
__readonly = ('display', 'width', 'height', 'depth')
def __init__(self, appname, display="", simpleapp=0):
def __init__(self, appname, display="", simpleapp=False):
wings.WMInitializeApplication(appname, len(sys.argv), sys.argv)
self._o = wings.pyWMOpenScreen(display, simpleapp)
if not self._o:
raise Error, "Cannot open display %s" % display
self.__dict__['display'] = wings.WMScreenDisplay(self._o)
self.__dict__['width'] = wings.WMScreenWidth(self._o)
self.__dict__['height'] = wings.WMScreenHeight(self._o)
@@ -69,7 +75,7 @@ class WMScreen:
class WMView:
pass
class WMWidget(WMView):
def __init__(self):
self._o = None
@@ -429,7 +435,7 @@ class WMTextField(WMWidget):
wings.WMSetTextFieldFont(self._o, font)
def font(self):
return wings.WMGettextFieldFont(self._o)
return wings.WMGetTextFieldFont(self._o)
################################################################################
@@ -509,7 +515,7 @@ if __name__ == "__main__":
win2.hide()
def dc(object, data, action):
print "didChnage:", object, data, action
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
@@ -520,7 +526,7 @@ if __name__ == "__main__":
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, txt.text()
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()
@@ -625,7 +631,7 @@ if __name__ == "__main__":
timer = WMPersistentTimer(1000, tcb, win)
#del(timer)
#timer.delete()
win2 = WMPanel(win, "anotherWindow", WMTitledWindowMask)
win2.setTitle("transient test window")
win2.resize(150, 50)

View File

@@ -11,6 +11,7 @@ wings = os.popen("get-wings-flags --cflags", "r")
lines = [x.strip() for x in wings.readlines()]
flags = reduce(lambda x,y: x+y, [x.split() for x in lines if x])
include_dirs = [x[2:] for x in flags]
#include_dirs += [".."]
wings.close()
## Get the library dirs
@@ -18,6 +19,7 @@ wings = os.popen("get-wings-flags --ldflags", "r")
lines = [x.strip() for x in wings.readlines()]
flags = reduce(lambda x,y: x+y, [x.split() for x in lines if x])
library_dirs = [x[2:] for x in flags]
#library_dirs += [".."]
wings.close()
## Get the libraries

View File

@@ -24,7 +24,7 @@ if __name__ == "__main__":
win2.hide()
def dc(object, data, action):
print "didChnage:", object, data, action
print "didChange:", object, data, action
def dbe(object, data, action):
print "didBeginEditing:", object, data, action
@@ -35,7 +35,7 @@ if __name__ == "__main__":
object.setFocusTo(txt2)
else:
object.setFocusTo(txt)
print "didEndEditing:", object, data, action, txt.text()
print "didEndEditing:", object, data, action, object.text()
def tcb(one):
old = list.selectedItemRow()

View File

@@ -159,7 +159,7 @@ WMCreateColorWell(WMWidget *parent)
cPtr->view->self = cPtr;
cPtr->view->delegate = &_ColorWellViewDelegate;
cPtr->colorView = W_CreateView(cPtr->view);
if (!cPtr->colorView) {
W_DestroyView(cPtr->view);
@@ -167,10 +167,10 @@ WMCreateColorWell(WMWidget *parent)
return NULL;
}
cPtr->colorView->self = cPtr;
WMCreateEventHandler(cPtr->view, ExposureMask|StructureNotifyMask
|ClientMessageMask, handleEvents, cPtr);
WMCreateEventHandler(cPtr->colorView, ExposureMask, handleEvents, cPtr);
WMCreateEventHandler(cPtr->colorView, ButtonPressMask|ButtonMotionMask
@@ -192,16 +192,16 @@ WMCreateColorWell(WMWidget *parent)
WMAddNotificationObserver(colorChangedObserver, cPtr,
WMColorPanelColorChangedNotification, NULL);
WMSetViewDragSourceProcs(cPtr->view, &_DragSourceProcs);
WMSetViewDragDestinationProcs(cPtr->view, &_DragDestinationProcs);
WMSetViewDragSourceProcs(cPtr->colorView, &_DragSourceProcs);
WMSetViewDragDestinationProcs(cPtr->colorView, &_DragDestinationProcs);
{
char *types[2] = {"application/X-color", NULL};
WMRegisterViewForDraggedTypes(cPtr->view, types);
WMRegisterViewForDraggedTypes(cPtr->colorView, types);
}
return cPtr;
}
@@ -370,12 +370,11 @@ handleDragEvents(XEvent *event, void *data)
offs.height = 2;
pixmap = makeDragPixmap(cPtr);
WMDragImageFromView(cPtr->view, pixmap, types,
WMDragImageFromView(cPtr->colorView, pixmap, types,
wmkpoint(event->xmotion.x_root,
event->xmotion.y_root),
offs, event, True);
WMReleasePixmap(pixmap);
}
}
@@ -419,7 +418,7 @@ destroyColorWell(ColorWell *cPtr)
if (cPtr->color)
WMReleaseColor(cPtr->color);
wfree(cPtr);
}

View File

@@ -62,36 +62,31 @@ static WMEventHook *extraEventHandler=NULL;
* WMCreateEventHandler--
* Create an event handler and put it in the event handler list for the
* view. If the same callback and clientdata are already used in another
* handler, the masks are swapped.
* handler, the masks are OR'ed.
*
*/
void
WMCreateEventHandler(WMView *view, unsigned long mask, WMEventProc *eventProc,
void *clientData)
{
W_EventHandler *handler, *ptr;
unsigned long eventMask;
W_EventHandler *hPtr;
WMArrayIterator iter;
handler = NULL;
eventMask = mask;
WM_ITERATE_ARRAY(view->eventHandlers, ptr, iter) {
if (ptr->clientData == clientData && ptr->proc == eventProc) {
handler = ptr;
eventMask |= ptr->eventMask;
WM_ITERATE_ARRAY(view->eventHandlers, hPtr, iter) {
if (hPtr->clientData==clientData && hPtr->proc==eventProc) {
hPtr->eventMask |= mask;
return;
}
}
if (!handler) {
handler = wmalloc(sizeof(W_EventHandler));
WMAddToArray(view->eventHandlers, handler);
}
hPtr = wmalloc(sizeof(W_EventHandler));
/* select events for window */
handler->eventMask = eventMask;
handler->proc = eventProc;
handler->clientData = clientData;
hPtr->eventMask = mask;
hPtr->proc = eventProc;
hPtr->clientData = clientData;
WMAddToArray(view->eventHandlers, hPtr);
}

View File

@@ -387,7 +387,7 @@ void
WMSetFontPanelAction(WMFontPanel *panel, WMAction2 *action, void *data)
{
panel->action = action;
panel->actionData = data;
panel->data = data;
}