From fa994f627ed8eb73562c8c33c746eab59b73f304 Mon Sep 17 00:00:00 2001 From: kojima Date: Mon, 20 Aug 2001 18:11:40 +0000 Subject: [PATCH] fixed crash bug with WM_CLASS==NULL etc --- ChangeLog | 6 ++ INSTALL | 1 + WINGs/Extras/wtableview.c | 2 +- WINGs/Makefile.am | 1 + WINGs/WINGs/WINGsP.h | 2 + WINGs/widgets.c | 4 ++ WINGs/wtextfield.c | 2 +- contrib/Makefile.am | 2 +- contrib/README | 11 ++- contrib/workspace_flip.patch | 126 +++++++++++++++++++++++++++++++++++ po/fi.po | 1 + src/actions.c | 2 +- src/application.c | 11 +-- src/rootmenu.c | 2 +- src/superfluous.c | 23 +++++++ src/switchmenu.c | 2 +- src/wconfig.h.in | 2 + 17 files changed, 188 insertions(+), 12 deletions(-) create mode 100644 contrib/workspace_flip.patch diff --git a/ChangeLog b/ChangeLog index 60661d75..a333b13a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +Changes since version 0.65.1: +............................. + +- fixed crash when saving empty menu item in WPrefs - Fixed some more bash specific constructs in wsetfont. (Marcelo E. Magallon ) +- fixed crash with broken apps that set null WM_CLASS Changes since version 0.65.0: ............................. @@ -26,6 +31,7 @@ Changes since version 0.65.0: Robert Marshall ) - Replaced almost all sprintf() calls with snprintf() - fixed crash when removing menu entry for Window List or Workspace submenu +- added WINDOW_BIRTH_ZOOM2 (Éric Tremblay ) Changes since version 0.64.0: ............................. diff --git a/INSTALL b/INSTALL index 52522b2a..4158bafa 100644 --- a/INSTALL +++ b/INSTALL @@ -37,6 +37,7 @@ SUPPORTED PLATFORMS - PowerMac / Power MachTen 4.1.1 over MacOS - Amiga 3000 running RedHat Linux 5.1 (Rawhide) - IBM S/390 running Linux +- IBM S/390 running Conectiva Linux (experimental) - iBook running Darwin - Windows NT with Cygwin/XFree86 - Sony PlayStation2 running Linux diff --git a/WINGs/Extras/wtableview.c b/WINGs/Extras/wtableview.c index 3f39b262..3ba543c0 100644 --- a/WINGs/Extras/wtableview.c +++ b/WINGs/Extras/wtableview.c @@ -944,7 +944,7 @@ static void setRowSelected(WMTableView *table, unsigned row, Bool flag) } } if (repaint && row < table->rows) { - //drawFullRow(table, row); + /*drawFullRow(table, row);*/ repaintTable(table); } } diff --git a/WINGs/Makefile.am b/WINGs/Makefile.am index d4899e8b..b130886e 100644 --- a/WINGs/Makefile.am +++ b/WINGs/Makefile.am @@ -57,6 +57,7 @@ libWINGs_a_SOURCES = \ wfont.c \ wfontpanel.c \ widgets.c \ + winputmethod.c \ wlabel.c \ wlist.c \ wmenuitem.c \ diff --git a/WINGs/WINGs/WINGsP.h b/WINGs/WINGs/WINGsP.h index 2ec68e6d..6f67b47f 100644 --- a/WINGs/WINGs/WINGsP.h +++ b/WINGs/WINGs/WINGsP.h @@ -132,6 +132,8 @@ typedef struct W_Screen { RContext *rcontext; + struct W_IMContext *imctx; + /* application related */ W_FocusInfo *focusInfo; diff --git a/WINGs/widgets.c b/WINGs/widgets.c index f1d80e57..9a613ced 100644 --- a/WINGs/widgets.c +++ b/WINGs/widgets.c @@ -617,6 +617,10 @@ WMCreateScreenWithRContext(Display *display, int screen, RContext *context) scrPtr->rootWin = RootWindow(display, screen); scrPtr->fontCache = WMCreateHashTable(WMStringPointerHashCallbacks); + + + /* create input method stuff */ + W_InitIMStuff(scrPtr); /* Create missing CUT_BUFFERs */ { diff --git a/WINGs/wtextfield.c b/WINGs/wtextfield.c index 678b0bb2..4cecb79b 100644 --- a/WINGs/wtextfield.c +++ b/WINGs/wtextfield.c @@ -1259,7 +1259,7 @@ handleTextFieldKeyPress(TextField *tPtr, XEvent *event) normal_key: default: if (!controled) { - if (count > 0 && isprint(buffer[0])) { + if (count > 0 && !iscntrl(buffer[0])) { if (tPtr->selection.count) WMDeleteTextFieldRange(tPtr, tPtr->selection); WMInsertTextFieldText(tPtr, buffer, tPtr->cursorPosition); diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 55784960..5c63df76 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am @@ -1,4 +1,4 @@ -EXTRA_DIST = README single_click.diff WindowMaker.spec.in +EXTRA_DIST = README single_click.diff WindowMaker.spec.in workspace_flip.patch diff --git a/contrib/README b/contrib/README index 3d8872a3..07790eec 100644 --- a/contrib/README +++ b/contrib/README @@ -3,7 +3,7 @@ This directory contains some patches contributed by ppl. Do NOT mail the wmaker developers for any problems with them. -single_click.diff +*** single_click.diff allows single click in dock @@ -16,3 +16,12 @@ John Morrissey updated for Window Maker 0.65.0 by: Daniel Richard G. + + +*** workspace_flip.patch + +Allows flipping across workspaces by putting the +mouse in the side of the workspace. + +author: +Martin Sarfy diff --git a/contrib/workspace_flip.patch b/contrib/workspace_flip.patch new file mode 100644 index 00000000..46d5f2fc --- /dev/null +++ b/contrib/workspace_flip.patch @@ -0,0 +1,126 @@ +diff -Naur WindowMaker-0.65.0/src/WindowMaker.h wmaker-workspaceflip/src/WindowMaker.h +--- WindowMaker-0.65.0/src/WindowMaker.h Sat Apr 28 01:41:21 2001 ++++ wmaker-workspaceflip/src/WindowMaker.h Sun Aug 12 12:51:14 2001 +@@ -397,6 +397,8 @@ + + int raise_delay; /* delay for autoraise. 0 is disabled */ + ++ int workspace_flip_delay; /* delay for workspace flipping, 0 is disabled */ ++ + int cmap_size; /* size of dithering colormap in colors + * per channel */ + +diff -Naur WindowMaker-0.65.0/src/defaults.c wmaker-workspaceflip/src/defaults.c +--- WindowMaker-0.65.0/src/defaults.c Fri May 11 00:16:49 2001 ++++ wmaker-workspaceflip/src/defaults.c Sun Aug 12 12:51:14 2001 +@@ -420,6 +420,9 @@ + {"RaiseDelay", "0", NULL, + &wPreferences.raise_delay, getInt, NULL + }, ++ {"WorkspaceFlipDelay", "0", NULL, ++ &wPreferences.workspace_flip_delay, getInt, NULL ++ }, + {"WindozeCycling", "YES", NULL, + &wPreferences.windows_cycling,getBool, NULL + }, +diff -Naur WindowMaker-0.65.0/src/event.c wmaker-workspaceflip/src/event.c +--- WindowMaker-0.65.0/src/event.c Sat Apr 28 01:41:21 2001 ++++ wmaker-workspaceflip/src/event.c Sun Aug 12 12:51:14 2001 +@@ -1676,12 +1676,53 @@ + } + } + ++#define DEL_TIMER(timer) { \ ++ WMDeleteTimerHandler(timer); \ ++ timer = NULL; \ ++} ++ ++ ++ ++static void ++flipRightWorkspace(void* data) ++{ ++ WScreen *scr = (WScreen*)data; ++ int x,y,tmp,last_workspace = scr->current_workspace; ++ Window tmpw; ++ ++ DEL_TIMER(scr->workspace_flip_right_timer); ++ ++ XQueryPointer(dpy,scr->root_win,&tmpw,&tmpw,&x,&y,&tmp,&tmp,&tmp); ++ if(x != scr->scr_width-1) return; ++ ++ wWorkspaceRelativeChange(scr, 1); ++ if(last_workspace != scr->current_workspace) ++ XWarpPointer(dpy,None,scr->root_win,0,0,0,0,1,y); ++} ++ ++static void ++flipLeftWorkspace(void* data) ++{ ++ WScreen *scr = (WScreen*)data; ++ int x,y,tmp,last_workspace = scr->current_workspace; ++ Window tmpw; ++ ++ DEL_TIMER(scr->workspace_flip_left_timer); ++ ++ XQueryPointer(dpy,scr->root_win,&tmpw,&tmpw,&x,&y,&tmp,&tmp,&tmp); ++ if(x != 0) return; ++ ++ wWorkspaceRelativeChange(scr, -1); ++ if(last_workspace != scr->current_workspace) ++ XWarpPointer(dpy,None,scr->root_win,0,0,0,0,scr->scr_width-2,y); ++} + + static void + handleMotionNotify(XEvent *event) + { + WMenu *menu; + WScreen *scr = wScreenForRootWindow(event->xmotion.root); ++ int left,right; + + if (wPreferences.scrollable_menus) { + if (scr->flags.jump_back_pending || +@@ -1697,6 +1738,29 @@ + wMenuScroll(menu, event); + } + } ++ ++ /* workspace flipping */ ++ if(!wPreferences.workspace_flip_delay) return; ++ ++ left = (event->xmotion.x_root == 0); ++ right = (event->xmotion.x_root == scr->scr_width-1); ++ ++ if(right && !scr->workspace_flip_right_timer) ++ scr->workspace_flip_right_timer = ++ WMAddTimerHandler(wPreferences.workspace_flip_delay, ++ flipRightWorkspace,scr); ++ ++ if(left && !scr->workspace_flip_left_timer) ++ scr->workspace_flip_left_timer = ++ WMAddTimerHandler(wPreferences.workspace_flip_delay, ++ flipLeftWorkspace,scr); ++ ++ if(!right && scr->workspace_flip_right_timer) ++ DEL_TIMER(scr->workspace_flip_right_timer); ++ ++ if(!left && scr->workspace_flip_left_timer) ++ DEL_TIMER(scr->workspace_flip_left_timer); ++ + #if 0 + if (event->xmotion.subwindow == None) + return; +diff -Naur WindowMaker-0.65.0/src/screen.h wmaker-workspaceflip/src/screen.h +--- WindowMaker-0.65.0/src/screen.h Sun Apr 15 03:23:01 2001 ++++ wmaker-workspaceflip/src/screen.h Sun Aug 12 12:51:14 2001 +@@ -273,6 +273,10 @@ + Window last_click_window; + int last_click_button; + ++ /* for workspace flipping when mouse hits edge */ ++ WMHandlerID *workspace_flip_left_timer; ++ WMHandlerID *workspace_flip_right_timer; ++ + /* balloon help data */ + struct _WBalloon *balloon; + diff --git a/po/fi.po b/po/fi.po index 6ccd48da..4bfc0927 100644 --- a/po/fi.po +++ b/po/fi.po @@ -1714,3 +1714,4 @@ msgstr "Tuhoa viimeinen" #: ../src/xutil.c:228 msgid "invalid data in selection" msgstr "virheellistä tietoa valinnassa" + diff --git a/src/actions.c b/src/actions.c index a92bd07a..c6120ef2 100644 --- a/src/actions.c +++ b/src/actions.c @@ -740,7 +740,7 @@ animateResizeZoom(WScreen *scr, int x, int y, int w, int h, #undef FRAMES -static void +void animateResize(WScreen *scr, int x, int y, int w, int h, int fx, int fy, int fw, int fh, int hiding) { diff --git a/src/application.c b/src/application.c index e7ef7dfb..f212cceb 100644 --- a/src/application.c +++ b/src/application.c @@ -413,7 +413,6 @@ wApplicationCreate(WScreen *scr, Window main_window) if (!tmp) extractClientIcon(wapp->app_icon); } - /* set the application instance index */ { WApplication *list = scr->wapp_list; @@ -424,14 +423,16 @@ wApplicationCreate(WScreen *scr, Window main_window) if (!WFLAGP(wwin, collapse_appicons)) return 0; */ +#define Xstreql(a, b) ((a) == (b) || (a && b && strcmp(a, b)==0)) + /* look for a free index # */ while (list) { - if (strcmp(wwin->wm_instance, - list->main_window_desc->wm_instance) == 0 + if (Xstreql(wwin->wm_instance, + list->main_window_desc->wm_instance) && - strcmp(wwin->wm_class, - list->main_window_desc->wm_class) == 0) { + Xstreql(wwin->wm_class, + list->main_window_desc->wm_class)) { if (list->index == index) { index++; diff --git a/src/rootmenu.c b/src/rootmenu.c index 6ca770df..3a262661 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -336,7 +336,7 @@ getLocalizedMenuFile(char *menu) if (!Locale) return NULL; - len = strlen(menu)+32; + len = strlen(menu)+strlen(Locale)+8; buffer = wmalloc(len); /* try menu.locale_name */ diff --git a/src/superfluous.c b/src/superfluous.c index 3e26468c..80ecd3ab 100644 --- a/src/superfluous.c +++ b/src/superfluous.c @@ -446,12 +446,35 @@ DoWindowBirth(WWindow *wwin) XFlush(dpy); } #else +#ifdef WINDOW_BIRTH_ZOOM2 +extern void animateResize(); + +void DoWindowBirth(WWindow *wwin) +{ + /* dummy stub */ + + int center_x, center_y; + int width = wwin->frame->core->width; + int height = wwin->frame->core->height; + int w = WMIN(width, 20); + int h = WMIN(height, 20); + WScreen *scr = wwin->screen_ptr; + + center_x = wwin->frame_x + (width - w) / 2; + center_y = wwin->frame_y + (height - h) / 2; + + animateResize(scr, center_x, center_y, 1, 1, + wwin->frame_x , wwin->frame_y, width, height, + 0); +} +#else void DoWindowBirth(WWindow *wwin) { /* dummy stub */ } #endif +#endif diff --git a/src/switchmenu.c b/src/switchmenu.c index 52af50b5..97652997 100644 --- a/src/switchmenu.c +++ b/src/switchmenu.c @@ -181,7 +181,7 @@ UpdateSwitchMenu(WScreen *scr, WWindow *wwin, int action) WMenu *switchmenu = scr->switch_menu; WMenuEntry *entry; char title[MAX_MENU_TEXT_LENGTH+6]; - int len = MAX_MENU_TEXT_LENGTH+6; + int len = sizeof(title); int i; int checkVisibility = 0; diff --git a/src/wconfig.h.in b/src/wconfig.h.in index d54a46c6..a86936fe 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -206,6 +206,8 @@ */ #undef WINDOW_BIRTH_ZOOM +#define WINDOW_BIRTH_ZOOM2 + /* * whether arrow drawing in clip buttons should be gradiented */