/*********************************************************************** * * Procedure: * HandleExpose - expose event handler * ***********************************************************************/ void HandleExpose() { if (Event.xexpose.count != 0) return; DBUG("HandleExpose","Routine Entered"); if (Tmp_win) { if ((Event.xany.window == Tmp_win->title_w)) { SetTitleBar(Tmp_win,(Scr.Hilite == Tmp_win),False); } else { SetBorder(Tmp_win,(Scr.Hilite == Tmp_win),True,True, Event.xany.window); } } return; }
/*********************************************************************** * * Procedure: * HandleButtonPress - ButtonPress event handler * ***********************************************************************/ void HandleButtonPress() { unsigned int modifier; Binding *MouseEntry; Window x; int LocalContext; DBUG("HandleButtonPress","Routine Entered"); /* click to focus stuff goes here */ if((Tmp_win)&&(Tmp_win->flags & ClickToFocus)&&(Tmp_win != Scr.Ungrabbed) && ((Event.xbutton.state& (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0)) { SetFocus(Tmp_win->w,Tmp_win,1); /* #ifdef CLICKY_MODE_1 */ if (Scr.ClickToFocusRaises || ((Event.xany.window != Tmp_win->w)&& (Event.xbutton.subwindow != Tmp_win->w)&& (Event.xany.window != Tmp_win->Parent)&& (Event.xbutton.subwindow != Tmp_win->Parent))) /* #endif */ { RaiseWindow(Tmp_win); } KeepOnTop(); /* Why is this here? Seems to cause breakage with * non-focusing windows! */ if(!(Tmp_win->flags & ICONIFIED)) { XSync(dpy,0); /* pass click event to just clicked to focus window? */ if (Scr.ClickToFocusPassesClick) XAllowEvents(dpy,ReplayPointer,CurrentTime); else /* don't pass click to just focused window */ XAllowEvents(dpy,AsyncPointer,CurrentTime); XSync(dpy,0); return; } } else if ((Tmp_win) && !(Tmp_win->flags & ClickToFocus) && (Event.xbutton.window == Tmp_win->frame) && Scr.MouseFocusClickRaises) { if (Tmp_win != Scr.LastWindowRaised && (Event.xbutton.state & (ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) == 0 && GetContext(Tmp_win,&Event, &PressedW) == C_WINDOW) { RaiseWindow(Tmp_win); KeepOnTop(); } XSync(dpy,0); XAllowEvents(dpy,ReplayPointer,CurrentTime); XSync(dpy,0); return; } XSync(dpy,0); XAllowEvents(dpy,ReplayPointer,CurrentTime); XSync(dpy,0); Context = GetContext(Tmp_win,&Event, &PressedW); LocalContext = Context; x= PressedW; if(Context == C_TITLE) SetTitleBar(Tmp_win,(Scr.Hilite == Tmp_win),False); else SetBorder(Tmp_win,(Scr.Hilite == Tmp_win),True,True,PressedW); ButtonWindow = Tmp_win; /* we have to execute a function or pop up a menu */ modifier = (Event.xbutton.state & mods_used); /* need to search for an appropriate mouse binding */ for (MouseEntry = Scr.AllBindings; MouseEntry != NULL; MouseEntry= MouseEntry->NextBinding) { if(((MouseEntry->Button_Key == Event.xbutton.button)|| (MouseEntry->Button_Key == 0))&& (MouseEntry->Context & Context)&& ((MouseEntry->Modifier == AnyModifier)|| (MouseEntry->Modifier == (modifier& (~LockMask))))&& (MouseEntry->IsMouse == 1)) { /* got a match, now process it */ ExecuteFunction(MouseEntry->Action,Tmp_win, &Event,Context,-1); break; } } PressedW = None; if(LocalContext!=C_TITLE) SetBorder(ButtonWindow,(Scr.Hilite == ButtonWindow),True,True,x); else SetTitleBar(ButtonWindow,(Scr.Hilite==ButtonWindow),False); ButtonWindow = NULL; }
void HandlePropertyNotify() { XTextProperty text_prop; Boolean OnThisPage = False; DBUG("HandlePropertyNotify","Routine Entered"); if ((!Tmp_win)|| (XGetGeometry(dpy, Tmp_win->w, &JunkRoot, &JunkX, &JunkY, &JunkWidth, &JunkHeight, &JunkBW, &JunkDepth) == 0)) return; /* Make sure at least part of window is on this page before giving it focus... */ if ( (Tmp_win->Desk == Scr.CurrentDesk) && ( ((Tmp_win->frame_x + Tmp_win->frame_width) >= 0 && Tmp_win->frame_x < Scr.MyDisplayWidth) && ((Tmp_win->frame_y + Tmp_win->frame_height) >= 0 && Tmp_win->frame_y < Scr.MyDisplayHeight) ) ) { OnThisPage = True; } switch (Event.xproperty.atom) { case XA_WM_TRANSIENT_FOR: { if(XGetTransientForHint(dpy, Tmp_win->w, &Tmp_win->transientfor)) { Tmp_win->flags |= TRANSIENT; RaiseWindow(Tmp_win); } else { Tmp_win->flags &= ~TRANSIENT; } } break; case XA_WM_NAME: if (!XGetWMName(dpy, Tmp_win->w, &text_prop)) return; free_window_names (Tmp_win, True, False); Tmp_win->name = (char *)text_prop.value; if (Tmp_win->name && strlen(Tmp_win->name) > 200) /* limit to prevent hanging X server */ Tmp_win->name[200] = 0; if (Tmp_win->name == NULL) Tmp_win->name = NoName; BroadcastName(M_WINDOW_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->name); /* fix the name in the title bar */ if(!(Tmp_win->flags & ICONIFIED)) SetTitleBar(Tmp_win,(Scr.Hilite==Tmp_win),True); /* * if the icon name is NoName, set the name of the icon to be * the same as the window */ if (Tmp_win->icon_name == NoName) { Tmp_win->icon_name = Tmp_win->name; BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->icon_name); RedoIconName(Tmp_win); } break; case XA_WM_ICON_NAME: if (!XGetWMIconName (dpy, Tmp_win->w, &text_prop)) return; free_window_names (Tmp_win, False, True); Tmp_win->icon_name = (char *) text_prop.value; if (Tmp_win->icon_name && strlen(Tmp_win->icon_name) > 200) /* limit to prevent hanging X server */ Tmp_win->icon_name[200] = 0; if (Tmp_win->icon_name == NULL) Tmp_win->icon_name = NoName; BroadcastName(M_ICON_NAME,Tmp_win->w,Tmp_win->frame, (unsigned long)Tmp_win,Tmp_win->icon_name); RedoIconName(Tmp_win); break; case XA_WM_HINTS: if (Tmp_win->wmhints) XFree ((char *) Tmp_win->wmhints); Tmp_win->wmhints = XGetWMHints(dpy, Event.xany.window); if(Tmp_win->wmhints == NULL) return; if((Tmp_win->wmhints->flags & IconPixmapHint)|| (Tmp_win->wmhints->flags & IconWindowHint)) if(Tmp_win->icon_bitmap_file == Scr.DefaultIcon) Tmp_win->icon_bitmap_file = (char *)0; if((Tmp_win->wmhints->flags & IconPixmapHint)|| (Tmp_win->wmhints->flags & IconWindowHint)) { if (!(Tmp_win->flags & SUPPRESSICON)) { if (Tmp_win->icon_w) XDestroyWindow(dpy,Tmp_win->icon_w); XDeleteContext(dpy, Tmp_win->icon_w, FvwmContext); if(Tmp_win->flags & ICON_OURS) { if(Tmp_win->icon_pixmap_w != None) { XDestroyWindow(dpy,Tmp_win->icon_pixmap_w); XDeleteContext(dpy, Tmp_win->icon_pixmap_w, FvwmContext); } } else XUnmapWindow(dpy,Tmp_win->icon_pixmap_w); } Tmp_win->icon_w = None; Tmp_win->icon_pixmap_w = None; Tmp_win->iconPixmap = (Window)NULL; if(Tmp_win->flags & ICONIFIED) { Tmp_win->flags &= ~ICONIFIED; Tmp_win->flags &= ~ICON_UNMAPPED; CreateIconWindow(Tmp_win, Tmp_win->icon_x_loc,Tmp_win->icon_y_loc); BroadcastPacket(M_ICONIFY, 7, Tmp_win->w, Tmp_win->frame, (unsigned long)Tmp_win, Tmp_win->icon_x_loc, Tmp_win->icon_y_loc, Tmp_win->icon_w_width, Tmp_win->icon_w_height); BroadcastConfig(M_CONFIGURE_WINDOW, Tmp_win); if (!(Tmp_win->flags & SUPPRESSICON)) { LowerWindow(Tmp_win); AutoPlace(Tmp_win); if(Tmp_win->Desk == Scr.CurrentDesk) { if(Tmp_win->icon_w) XMapWindow(dpy, Tmp_win->icon_w); if(Tmp_win->icon_pixmap_w != None) XMapWindow(dpy, Tmp_win->icon_pixmap_w); } } Tmp_win->flags |= ICONIFIED; DrawIconWindow(Tmp_win); } } break; case XA_WM_NORMAL_HINTS: GetWindowSizeHints (Tmp_win); #if 0 /* ** ckh - not sure why this next stuff was here, but fvwm 1.xx ** didn't do this, and it seems to cause a bug when changing ** fonts in XTerm */ { int new_width, new_height; new_width = Tmp_win->frame_width; new_height = Tmp_win->frame_height; ConstrainSize(Tmp_win, &new_width, &new_height, False, 0, 0); if((new_width != Tmp_win->frame_width)|| (new_height != Tmp_win->frame_height)) SetupFrame(Tmp_win,Tmp_win->frame_x, Tmp_win->frame_y, new_width,new_height,False); } #endif /* 0 */ BroadcastConfig(M_CONFIGURE_WINDOW,Tmp_win); break; default: if(Event.xproperty.atom == _XA_WM_PROTOCOLS) FetchWmProtocols (Tmp_win); else if (Event.xproperty.atom == _XA_WM_COLORMAP_WINDOWS) { FetchWmColormapWindows (Tmp_win); /* frees old data */ ReInstallActiveColormap(); } else if(Event.xproperty.atom == _XA_WM_STATE) { if((Tmp_win != NULL)&&(Tmp_win->flags & ClickToFocus) &&(Tmp_win == Scr.Focus)) { if (OnThisPage) { Scr.Focus = NULL; SetFocus(Tmp_win->w,Tmp_win,0); } } } break; } }
BOOL HandleSaveCommand(HWND hWindow, WPARAM wParam, BOOL fCommand) /***********************************************************************/ { FNAME szFileName; //LPSTR lpString; int idDataType, idOldDataType, idFileType, idOldFileType; BOOL fChanged, fStatus; DWORD dwReturn; if (ImgInMaskEditMode(lpImage)) { ImgSetupMaskEditMode(lpImage); UpdateStatusBar(NO, NO, NO, NO); } fStatus = YES; switch (wParam) { case IDM_SAVE: if ( !lpImage ) break; PPOLEClientNotify( (LPIMAGEOBJECT)lpImage->pObj, OLE_CHANGED ); #ifdef USEOLE OleSavedServerDoc( lpImage->lhDoc ); #endif // #ifdef USEOLE if ( lpImage->fOwnedByClient ) { // If it IS embedded client data, inform the client // ImgEditApplyAll( lpImage, YES/*fApplyData*/, YES/*fApplyAlpha*/ ); break; } /* Save the image under the current name */ if ( !lpImage->fUntitled) /* If the picture has a name, save into it */ { if ( !(fStatus = AstralImageSave( lpImage->FileType, lpImage->DataType, lpImage->CurFile )) ) break; SetImgChanged(lpImage, NO); // ImgEditApplyAll( lpImage, YES/*fApplyData*/, YES/*fApplyAlpha*/ ); break; } /* else fall through to SaveAs... */ case IDM_SAVEAS: if ( !lpImage ) break; /* Bring up the modal 'SaveAs' box */ // save current image format information lstrcpy(szFileName, lpImage->CurFile); fChanged = lpImage->fChanged; idOldDataType = lpImage->DataType; idOldFileType = IDN_ART; // save all as ART files // ask user for a name if ( !(dwReturn = DoOpenDlg( hWindow, IDD_SAVEAS, lpImage->FileType, szFileName, YES )) ) { fStatus = NO; break; } // save the image in the user specified file type and data type idFileType = LOWORD( dwReturn ); idDataType = HIWORD( dwReturn ); if ( !(fStatus = AstralImageSave( idFileType, idDataType, szFileName ))) break; // // If it IS NOT embedded client data, inform the client PPOLEClientNotify( (LPIMAGEOBJECT)lpImage->pObj, OLE_CHANGED ); #ifdef USEOLE OleSavedServerDoc( lpImage->lhDoc ); #endif // #ifdef USEOLE // whenever you save changes become permanent - NOT ANY MORE - tmr SetImgChanged(lpImage, NO); // ImgEditApplyAll( lpImage, YES/*fApplyData*/, YES/*fApplyAlpha*/ ); // Add the file name to our recall list AddRecallImageName( szFileName ); if (!fCommand) break; // If this is a chunked image, don't revert or change name if (lpImage->DocumentType == IMG_DOCPIECE) break; if (ImgInMaskEditMode(lpImage)) break; // if data type or file type did not change, just take new name if ( idDataType == idOldDataType && idFileType == idOldFileType ) { // it has the same FileType, same DataType lpImage->fUntitled = NO; lstrcpy( lpImage->CurFile, szFileName ); /* Force the non-client area (title bar) of image to paint */ SetTitleBar(lpImage->hWnd); #ifdef USEOLE // If it IS NOT embedded client data, inform the client OleRenameServerDoc( lpImage->lhDoc, lpImage->CurFile); #endif // #ifdef USEOLE break; } // see if the user wants to convert to using the new format if ( !AstralAffirm(IDS_CONFIRM_CONVERT) ) { // the user doesn't want to convert to the new format lpImage->fChanged = fChanged; // restore the changed flag break; } // the user wants to convert to the new format lpImage->FileType = idFileType; lpImage->DataType = idDataType; lpImage->fUntitled = NO; lstrcpy( lpImage->CurFile, szFileName ); /* Force the non-client area (title bar) of image to paint */ SetTitleBar(lpImage->hWnd); #ifdef USEOLE // If it IS NOT embedded client data, inform the client OleRenameServerDoc( lpImage->lhDoc, lpImage->CurFile); #endif // #ifdef USEOLE DoCommand(hWindow, IDM_REVERT, 0L); break; case IDM_SAVESPECIAL: if ( !lpImage ) break; // save current image format information lstrcpy(szFileName, lpImage->CurFile); fChanged = lpImage->fChanged; idOldDataType = lpImage->DataType; idOldFileType = IDN_ART; // save all as ART files if (lpImage->fUntitled) { // get the new name for the file GetNextIniFilename ((char FAR *)&szFileName); SaveToIniEntry (szFileName, NULL); } else { lstrcpy (szFileName, lpImage->CurFile); } // save the image as the same type idFileType = idOldFileType; idDataType = idOldDataType; if ( !(fStatus = AstralImageSave( idFileType, idDataType, szFileName ))) break; // whenever you save changes become permanent - NOT ANY MORE - tmr SetImgChanged(lpImage, NO); // ImgEditApplyAll( lpImage, YES/*fApplyData*/, YES/*fApplyAlpha*/ ); // Add the file name to our recall list AddRecallImageName( szFileName ); if (!fCommand) break; // If this is a chunked image, don't revert or change name if (lpImage->DocumentType == IMG_DOCPIECE) break; if (ImgInMaskEditMode(lpImage)) break; // if data type or file type did not change, just take new name if ( idDataType == idOldDataType && idFileType == idOldFileType ) { // it has the same FileType, same DataType lpImage->fUntitled = NO; lstrcpy( lpImage->CurFile, szFileName ); /* Force the non-client area (title bar) of image to paint */ SetTitleBar(lpImage->hWnd); #ifdef USEOLE OleRenameServerDoc( lpImage->lhDoc, lpImage->CurFile ); #endif // #ifdef USEOLE break; } // see if the user wants to convert to using the new format if ( !AstralAffirm(IDS_CONFIRM_CONVERT) ) { // the user doesn't want to convert to the new format lpImage->fChanged = fChanged; // restore the changed flag break; } // the user wants to convert to the new format lpImage->FileType = idFileType; lpImage->DataType = idDataType; lpImage->fUntitled = NO; lstrcpy( lpImage->CurFile, szFileName ); /* Force the non-client area (title bar) of image to paint */ SetTitleBar(lpImage->hWnd); // If it IS NOT embedded client data, inform the client #ifdef USEOLE OleRenameServerDoc( lpImage->lhDoc, lpImage->CurFile ); #endif // #ifdef USEOLE DoCommand(hWindow, IDM_REVERT, 0L); break; default: break; } return( fStatus ); }