Skip to content

Commit 0a16083

Browse files
committed
'New' X11 port now supports setting/changing the title bar (PDC_set_title() function).
1 parent 3267806 commit 0a16083

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

x11new/pdcscrn.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void PDC_scr_close( void)
6464
return;
6565
}
6666

67-
static XTextProperty xtpWinName, xtpIconName;
67+
XTextProperty xtpWinName, xtpIconName;
6868

6969
void PDC_scr_free( void)
7070
{
@@ -76,8 +76,10 @@ void PDC_scr_free( void)
7676
XFree( xwmhHints);
7777
XFree( xshSize);
7878
XFreeGC( dis, curr_gc);
79+
XUnloadFont( dis, font);
7980
XCloseDisplay( dis);
80-
XFree( xtpWinName.value);
81+
if( xtpWinName.value)
82+
XFree( xtpWinName.value);
8183
XFree( xtpIconName.value);
8284
#ifdef USING_COMBINING_CHARACTER_SCHEME
8385
PDC_expand_combined_characters( 0, NULL);
@@ -109,7 +111,7 @@ int PDC_scr_open(void)
109111
long event_mask = ExposureMask | KeyPressMask | ButtonPressMask | ClientMessage
110112
| ButtonReleaseMask | StructureNotifyMask | PointerMotionMask;
111113
char *pcIconName = "Icon Name?";
112-
char *pcWinName = "Insert Window Name Here", *pcProgName = "Test App";
114+
char *pcProgName = "Test App";
113115
const char *font_name = "-misc-fixed-medium-r-normal--15-*10646-1*";
114116

115117
PDC_LOG(("PDC_scr_open called\n"));
@@ -171,7 +173,6 @@ int PDC_scr_open(void)
171173
xchClass = XAllocClassHint();
172174

173175
xshSize->flags = PPosition | PSize;
174-
XStringListToTextProperty(&pcWinName, 1, &xtpWinName);
175176
XStringListToTextProperty(&pcIconName, 1, &xtpIconName);
176177

177178
xwmhHints->initial_state = NormalState;
@@ -181,8 +182,10 @@ int PDC_scr_open(void)
181182
xchClass->res_name = pcProgName;
182183
xchClass->res_class = "Base Win";
183184

184-
XSetWMProperties( dis, win, &xtpWinName, &xtpIconName, NULL, 0,
185+
XSetWMProperties( dis, win, NULL, &xtpIconName, NULL, 0,
185186
xshSize, xwmhHints, xchClass);
187+
if( xtpWinName.value)
188+
XSetWMName( dis, win, &xtpWinName);
186189
XSetWMProtocols( dis, win, &wmDeleteMessage, 1);
187190
XMapWindow(dis, win);
188191

x11new/pdcsetsc.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <stdio.h>
2+
#include <stdlib.h>
23
#include <curspriv.h>
34
#include "pdcx11.h"
45

@@ -79,5 +80,12 @@ void PDC_set_title( const char *title)
7980
{
8081
PDC_LOG(("PDC_set_title() - called:<%s>\n", title));
8182

82-
INTENTIONALLY_UNUSED_PARAMETER( title);
83+
char *temp_string = strdup( title);
84+
85+
if( xtpWinName.value)
86+
XFree( xtpWinName.value);
87+
XStringListToTextProperty( &temp_string, 1, &xtpWinName);
88+
if( dis && win)
89+
XSetWMName( dis, win, &xtpWinName);
90+
free( temp_string);
8391
}

x11new/pdcx11.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extern Font font;
1111
extern Atom wmDeleteMessage;
1212
extern int PDC_font_width, PDC_font_height, PDC_font_descent;
1313
extern int PDC_cols, PDC_rows;
14+
extern XTextProperty xtpWinName, xtpIconName;
1415

1516
void PDC_free_xim_xic( void);
1617
void PDC_check_for_blinking( void);

0 commit comments

Comments
 (0)