Skip to content

Commit

Permalink
Fixed a deiconization problem on macOS. Also implemented patches from…
Browse files Browse the repository at this point in the history
… Shuei Yamada (KEK) to fix two buffer overflows.
  • Loading branch information
Robert Soliday committed Jun 26, 2017
1 parent b4727a4 commit 06c32a5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
37 changes: 35 additions & 2 deletions medm/medm.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,32 @@ void requestDestroy(request_t *request) {
#endif
#endif


void IconifyMe (dpy, win)
Display *dpy;
Window win; /* toplevel window to iconify */
{
Atom xa_WM_CHANGE_STATE;
XClientMessageEvent ev;

xa_WM_CHANGE_STATE = XInternAtom (dpy,
"WM_CHANGE_STATE", False);

ev.type = ClientMessage;
ev.display = dpy;
ev.message_type = xa_WM_CHANGE_STATE;
ev.format = 32;
ev.data.l[0] = IconicState;
ev.window = win;

XSendEvent (dpy,
RootWindow (dpy, DefaultScreen(dpy)),
True,
(SubstructureRedirectMask | SubstructureNotifyMask),
&ev);
XFlush (dpy);
}

request_t * parseCommandLine(int argc, char *argv[]) {
int i;
int argsUsed = 0;
Expand Down Expand Up @@ -3025,7 +3051,7 @@ DisplayInfo* parseDisplayFile(char *filename) {
/**************************************************************************/
int main(int argc, char *argv[])
{
int i = 0, n = 0, index = 0;
int i = 0, n = 0, index = 0, iconify=0;
Arg args[5];
FILE *filePtr;
XColor color;
Expand Down Expand Up @@ -3514,7 +3540,8 @@ int main(int argc, char *argv[])
} else if(request->opMode == EXECUTE) {
globalDisplayListTraversalMode = DL_EXECUTE;
if(request->fileCnt > 0) { /* assume .adl file names follow */
XtVaSetValues(mainShell, XmNinitialState, IconicState, NULL);
//XtVaSetValues(mainShell, XmNinitialState, IconicState, NULL);
iconify=1;
}
/* Start the scheduler */
startMedmScheduler();
Expand Down Expand Up @@ -3747,6 +3774,12 @@ int main(int argc, char *argv[])
/* Get CDE workspace list */
GetWorkSpaceList(mainMW);
#endif
if (iconify) {
//IconifyMe(display, XtWindow(mainShell));
XIconifyWindow(display, XtWindow(mainShell), screenNum);

}


/* Go into event loop
* Normally just XtAppMainLoop(appContext)
Expand Down
2 changes: 1 addition & 1 deletion medm/medmRelatedDisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ void executeDlRelatedDisplay(DisplayInfo *displayInfo, DlElement *dlElement)
dlRelatedDisplay->visual == RD_COL_OF_BTN) {
/* Case 3 of 4 */
/* Rows or columns of buttons */
Arg wargs[20];
Arg wargs[MAX_RELATED_DISPLAYS+16];
int i = 0, maxChars = 0, usedWidth = 0, usedHeight = 0;
XmFontList fontList;
Pixel fg, bg;
Expand Down
6 changes: 3 additions & 3 deletions medm/medmVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
*/
#define MEDM_VERSION 3
#define MEDM_REVISION 1
#define MEDM_MODIFICATION 13
#define MEDM_MODIFICATION 14
#define MEDM_PATCH_LEVEL 0
#define MEDM_VERSION_STRING "MEDM Version 3.1.13"
#define MEDM_VERSION_DIGITS "MEDM030113"
#define MEDM_VERSION_STRING "MEDM Version 3.1.14"
#define MEDM_VERSION_DIGITS "MEDM030114"
2 changes: 1 addition & 1 deletion medm/resourcePalette.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ static void optionMenuSimpleCallback(Widget w, XtPointer cd, XtPointer cbs)
{
DisplayInfo *cdi = currentDisplayInfo;
int buttonId = (intptr_t)cd;
int rcType;
long rcType;
DlElement *elementPtr;

UNREFERENCED(cbs);
Expand Down

0 comments on commit 06c32a5

Please sign in to comment.