Skip to content

Commit 5bb9bf9

Browse files
committed
started c++ conv
1 parent 6b3e21f commit 5bb9bf9

File tree

15 files changed

+32
-71
lines changed

15 files changed

+32
-71
lines changed

LFSTray/LFSTray/app/Makefile.am

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,3 @@ man1_MANS = ../resources/man/lfstray.1
1010

1111
bin_PROGRAMS = lfstray
1212

13-
#doc_DIST=lfstray.sample
14-
#dist_hook: lfstray.1
15-
#all-local: $(doc_DIST)
16-
#clean-local:
17-
# rm -f $(doc_DIST)
18-
#
19-
#lfstray.sample:
20-
# VERSION_STR=`echo @VERSION@|sed 's/\([^\.]*\.[^\.]*\)\..*/\1/'`;cat lfstray.sample.in|sed "s/@VERSION_STR@/$$VERSION_STR/g" > lfstray.sample
21-
22-
23-
24-
25-
#man_MANS=lfstray.1
26-
#
27-
#doc_DIST=lfstray.sample
28-
#dist_hook: lfstray.1
29-
#all-local: $(doc_DIST)
30-
#clean-local:
31-
# rm -f $(doc_DIST)
32-
#
33-
#lfstray.sample:
34-
# VERSION_STR=`echo @VERSION@|sed 's/\([^\.]*\.[^\.]*\)\..*/\1/'`;cat lfstray.sample.in|sed "s/@VERSION_STR@/$$VERSION_STR/g" > lfstray.sample
35-
#
36-
#
37-
#bin_PROGRAMS = lfstray
38-
#lfstray_SOURCES = main.c icons.c icons.h xembed.c xembed.h layout.c layout.h embed.c embed.h \
39-
# settings.c settings.h xutils.c xutils.h tray.c tray.h list.h \
40-
# wmh.c wmh.h common.h image.c image.h
41-
#
42-
#AM_CFLAGS = @X_CFLAGS@
43-
#lfstray_LDADD = @X_LIBS@ @X_PRE_LIBS@ -lX11 @X_EXTRA_LIBS@

LFSTray/LFSTray/sources

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
COMMONSRC = ../src/embed.c ../src/icons.c ../src/image.c ../src/layout.c ../src/main.c ../src/settings.c ../src/tray.c ../src/wmh.c ../src/xembed.c ../src/xutils.c
1+
COMMONSRC = ../src/embed.cpp ../src/icons.cpp ../src/image.cpp ../src/layout.cpp ../src/main.cpp ../src/settings.cpp ../src/tray.cpp ../src/wmh.cpp ../src/xembed.cpp ../src/xutils.cpp

LFSTray/LFSTray/src/Makefile.am

Lines changed: 0 additions & 7 deletions
This file was deleted.
File renamed without changes.

LFSTray/LFSTray/src/icons.c renamed to LFSTray/LFSTray/src/icons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct TrayIcon *icon_list_new(Window wid,int cmode)
4848
struct TrayIcon *new_icon;
4949
/* Do not allocate second structure for the same window */
5050
if(icon_list_find(wid)!=NULL) return NULL;
51-
if((new_icon=malloc(sizeof(struct TrayIcon)))==NULL)
51+
if((new_icon=(TrayIcon*)malloc(sizeof(struct TrayIcon)))==NULL)
5252
{
5353
return NULL;
5454
}

LFSTray/LFSTray/src/image.c renamed to LFSTray/LFSTray/src/image.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ CARD8 *image_create_alpha_mask(int ord,int w,int h)
9898

9999
bord=(1 << ord)-1;
100100

101-
m=malloc(w * h);
101+
m=(unsigned char*)malloc(w * h);
102102
if(m==NULL) return NULL;
103103
memset(m,255,w * h);
104104

LFSTray/LFSTray/src/layout.c renamed to LFSTray/LFSTray/src/layout.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,7 @@ int icon_placement_create(struct IconPlacement *ip,int x,int y,struct Rect *rect
362362
* - position for A is less (in lexographical order)
363363
* than position for B.
364364
* */
365-
void icon_placement_choose_best(
366-
struct IconPlacement *old,struct IconPlacement *new)
365+
void icon_placement_choose_best(struct IconPlacement *old,struct IconPlacement *newst)
367366
{
368367
int old_lout_delta_norm,new_lout_delta_norm;
369368
int lout_norm_cmp;
@@ -384,7 +383,7 @@ void icon_placement_choose_best(
384383
swap(settings.orig_tray_dims.x,settings.orig_tray_dims.y);
385384
}
386385
calc_wnd_sz_delta(old_wnd_sz_delta,old);
387-
calc_wnd_sz_delta(new_wnd_sz_delta,new);
386+
calc_wnd_sz_delta(new_wnd_sz_delta,newst);
388387
/* Some black magic. This is probably buggy and you are not supposed to
389388
* understand this (I definetly don't). The basic idea is that sometimes
390389
* layout resize means window resize. Sometimes it does not. */
@@ -393,12 +392,12 @@ void icon_placement_choose_best(
393392
if(grid_sz.x >= settings.orig_tray_dims.x/settings.slot_size.x)
394393
{
395394
old_wnd_sz_delta.x=old->sz_delta.x*settings.slot_size.x;
396-
new_wnd_sz_delta.x=new->sz_delta.x *settings.slot_size.x;
395+
new_wnd_sz_delta.x=newst->sz_delta.x *settings.slot_size.x;
397396
}
398397
if(grid_sz.y >= settings.orig_tray_dims.y/settings.slot_size.y)
399398
{
400399
old_wnd_sz_delta.y=old->sz_delta.y*settings.slot_size.y;
401-
new_wnd_sz_delta.y=new->sz_delta.y *settings.slot_size.y;
400+
new_wnd_sz_delta.y=newst->sz_delta.y *settings.slot_size.y;
402401
}
403402
}
404403
/* Restore values */
@@ -413,7 +412,7 @@ void icon_placement_choose_best(
413412
wnd_norm_cmp=new_wnd_delta_norm<old_wnd_delta_norm;
414413
/* Compute norms for layout deltas */
415414
old_lout_delta_norm=old->sz_delta.x+old->sz_delta.y;
416-
new_lout_delta_norm=new->sz_delta.x+new->sz_delta.y;
415+
new_lout_delta_norm=newst->sz_delta.x+newst->sz_delta.y;
417416
lout_norm_cmp=new_lout_delta_norm<old_lout_delta_norm;
418417

419418
/* CORE of placement logic. In short,
@@ -424,16 +423,16 @@ void icon_placement_choose_best(
424423
* than one that does
425424
*-otherwise,placement that is "closer" to initial point (that depends
426425
* on gravity) is better */
427-
if(!old->valid && new->valid) goto replace;
426+
if(!old->valid && newst->valid) goto replace;
428427
if(settings.min_space_policy && (lout_norm_cmp || wnd_norm_cmp))
429428
goto replace;
430429
if(old_lout_delta_norm && !new_lout_delta_norm) goto replace;
431430
if(old_wnd_delta_norm && !new_wnd_delta_norm) goto replace;
432-
if((!old_lout_delta_norm==!new_lout_delta_norm) && compare_points(new->pos,old->pos))
431+
if((!old_lout_delta_norm==!new_lout_delta_norm) && compare_points(newst->pos,old->pos))
433432
goto replace;
434433
return;
435434
replace:
436-
*old=*new;
435+
*old=*newst;
437436
}
438437

439438
/* WARNING: returns ptr to STATIC buffer */
File renamed without changes.

LFSTray/LFSTray/src/settings.c renamed to LFSTray/LFSTray/src/settings.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ struct Settings settings;
5858
/* Initialize data */
5959
void init_default_settings()
6060
{
61-
settings.bg_color_str="gray";
62-
settings.tint_color_str="white";
61+
settings.bg_color_str=(char*)"gray";
62+
settings.tint_color_str=(char*)"white";
6363
settings.display_str=NULL;
6464
settings.geometry_str=NULL;
65-
settings.max_geometry_str="0x0";
65+
settings.max_geometry_str=(char*)"0x0";
6666
settings.icon_size=FALLBACK_ICON_SIZE;
6767
settings.slot_size.x=-1;
6868
settings.slot_size.y=-1;
@@ -77,7 +77,7 @@ void init_default_settings()
7777
settings.grow_gravity=GRAV_N | GRAV_W;
7878
settings.icon_gravity=GRAV_N | GRAV_W;
7979
settings.wnd_layer=NULL;
80-
settings.wnd_name=PROGNAME;
80+
settings.wnd_name=(char*)PROGNAME;
8181
settings.xsync=0;
8282
settings.need_help=0;
8383
settings.config_fname=NULL;
@@ -104,7 +104,7 @@ int parse_ignored_classes(int argc,const char **argv,void **references,int silen
104104

105105
for(i=0; i<argc; i++)
106106
{
107-
newclass=malloc(sizeof(struct WindowClass));
107+
newclass=(WindowClass*)malloc(sizeof(struct WindowClass));
108108
newclass->name=strdup(argv[i]);
109109
LIST_ADD_ITEM(*classes,newclass);
110110
}
@@ -270,9 +270,9 @@ int parse_wnd_layer(int argc,const char **argv,void **references,int silent)
270270
char **window_layer=(char **) references[0];
271271

272272
if(!strcasecmp(argv[0],"top"))
273-
*window_layer=_NET_WM_STATE_ABOVE;
273+
*window_layer=(char*)_NET_WM_STATE_ABOVE;
274274
else if(!strcasecmp(argv[0],"bottom"))
275-
*window_layer=_NET_WM_STATE_BELOW;
275+
*window_layer=(char*)_NET_WM_STATE_BELOW;
276276
else if(!strcasecmp(argv[0],"normal"))
277277
*window_layer=NULL;
278278
else
@@ -1006,7 +1006,7 @@ int get_args(char *line,int *argc,char ***argv)
10061006
{
10071007
(*argc)++;
10081008
/* Add space to store one more argument */
1009-
if(NULL==(*argv=realloc(*argv,*argc * sizeof(char *))))
1009+
if(NULL==(*argv=(char**)realloc(*argv,*argc * sizeof(char *))))
10101010
DIE_OOM(("Could not allocate memory to parse parameters\n"));
10111011
if(*arg_start=='"') /* 4.1. argument is quoted: find matching quote */
10121012
{

LFSTray/LFSTray/src/tray.c renamed to LFSTray/LFSTray/src/tray.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ void tray_create_window(int argc,char **argv)
445445
{
446446
if(XmbTextListToTextProperty(tray_data.dpy,&settings.wnd_name,1,XTextStyle,&wm_name)!=Success)
447447
/* Retry with default value */
448-
settings.wnd_name=PROGNAME;
448+
settings.wnd_name=(char*)PROGNAME;
449449
else
450450
break;
451451
if(numtries++ > 1)
@@ -458,8 +458,8 @@ void tray_create_window(int argc,char **argv)
458458
XSetWMName(tray_data.dpy,tray_data.tray,&wm_name);
459459
XFree(wm_name.value);
460460
/* Setup class hints */
461-
xch.res_class=PROGNAME;
462-
xch.res_name=PROGNAME;
461+
xch.res_class=(char*)PROGNAME;
462+
xch.res_name=(char*)PROGNAME;
463463
/* Setup window manager hints */
464464
xwmh.flags=StateHint | InputHint;
465465
xwmh.input=False;
@@ -510,17 +510,17 @@ int tray_set_wm_hints()
510510
mwm_set_hints(tray_data.dpy,tray_data.tray,mwm_decor,MWM_FUNC_ALL);
511511
if(settings.sticky)
512512
{
513-
ewmh_add_window_state(tray_data.dpy,tray_data.tray,_NET_WM_STATE_STICKY);
514-
ewmh_set_window_atom32(tray_data.dpy,tray_data.tray,_NET_WM_DESKTOP,0xFFFFFFFF);
513+
ewmh_add_window_state(tray_data.dpy,tray_data.tray,(char*)_NET_WM_STATE_STICKY);
514+
ewmh_set_window_atom32(tray_data.dpy,tray_data.tray,(char*)_NET_WM_DESKTOP,0xFFFFFFFF);
515515
}
516516
if(settings.skip_taskbar)
517-
ewmh_add_window_state(tray_data.dpy,tray_data.tray,_NET_WM_STATE_SKIP_TASKBAR);
517+
ewmh_add_window_state(tray_data.dpy,tray_data.tray,(char*)_NET_WM_STATE_SKIP_TASKBAR);
518518
if(settings.wnd_layer!=NULL)
519519
ewmh_add_window_state(tray_data.dpy,tray_data.tray,settings.wnd_layer);
520-
ewmh_add_window_type(tray_data.dpy,tray_data.tray,_NET_WM_WINDOW_TYPE_DOCK);
520+
ewmh_add_window_type(tray_data.dpy,tray_data.tray,(char*)_NET_WM_WINDOW_TYPE_DOCK);
521521
/* Alwas add NORMAL window type for WM that do not support (some) special
522522
* types */
523-
ewmh_add_window_type(tray_data.dpy,tray_data.tray,_NET_WM_WINDOW_TYPE_NORMAL);
523+
ewmh_add_window_type(tray_data.dpy,tray_data.tray,(char*)_NET_WM_WINDOW_TYPE_NORMAL);
524524
return SUCCESS;
525525
}
526526

File renamed without changes.
File renamed without changes.
File renamed without changes.

LFSTray/Makefile.am

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
SUBDIRS=LFSTray/app
2-
#
3-
#man_MANS=lfstray.1
4-
#
2+
53
doc_DIST=lfstray.sample
64
dist_hook: lfstray.1
75
all-local: $(doc_DIST)

LFSTray/lfstray.sample.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#
2-
# This is sample ~/.simpletrayrc, resembling default configuration.
2+
# This is a sample configuration.
3+
# copy to ~/.config/LFS/lfstrayrc
4+
#
35
# Remember: command line parameters take precedence.
46
#
57
# Directives introduced in @VERSION_STR@ are marked with "NEW in @VERSION_STR@"
68
#
79
####################################################################
810
#
9-
# simpletray understands following directives
11+
# lfstrayrc understands the following directives
1012
#
1113
####################################################################
1214

0 commit comments

Comments
 (0)