Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav
yad
Commits
c5de754e
Commit
c5de754e
authored
Apr 29, 2018
by
Victor Ananjesky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite geometry parsing
parent
c663ee33
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
45 deletions
+57
-45
main.c
src/main.c
+2
-45
util.c
src/util.c
+53
-0
yad.h
src/yad.h
+2
-0
No files found.
src/main.c
View file @
c5de754e
...
@@ -381,7 +381,7 @@ create_dialog (void)
...
@@ -381,7 +381,7 @@ create_dialog (void)
gtk_container_set_border_width
(
GTK_CONTAINER
(
dlg
),
(
guint
)
options
.
data
.
borders
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
dlg
),
(
guint
)
options
.
data
.
borders
);
/* set window size and position */
/* set window size and position */
if
(
!
options
.
data
.
geometry
&&
!
options
.
data
.
maximized
&&
!
options
.
data
.
fullscreen
)
if
(
!
options
.
data
.
maximized
&&
!
options
.
data
.
fullscreen
)
{
{
if
(
options
.
data
.
center
)
if
(
options
.
data
.
center
)
gtk_window_set_position
(
GTK_WINDOW
(
dlg
),
GTK_WIN_POS_CENTER_ALWAYS
);
gtk_window_set_position
(
GTK_WINDOW
(
dlg
),
GTK_WIN_POS_CENTER_ALWAYS
);
...
@@ -596,51 +596,8 @@ create_dialog (void)
...
@@ -596,51 +596,8 @@ create_dialog (void)
if
(
!
options
.
data
.
maximized
&&
!
options
.
data
.
fullscreen
)
if
(
!
options
.
data
.
maximized
&&
!
options
.
data
.
fullscreen
)
{
{
gtk_widget_realize
(
dlg
);
gtk_widget_realize
(
dlg
);
/* parse geometry string */
if
(
options
.
data
.
geometry
)
{
gchar
**
geom
;
geom
=
g_new0
(
gchar
*
,
5
);
parse_geometry
();
if
(
*
options
.
data
.
geometry
==
'+'
||
*
options
.
data
.
geometry
==
'-'
)
{
geom
=
g_strsplit_set
(
options
.
data
.
geometry
,
"+-"
,
3
);
if
(
geom
[
1
])
{
options
.
data
.
use_posx
=
TRUE
;
options
.
data
.
posx
=
atoi
(
geom
[
1
]);
if
(
geom
[
2
])
{
options
.
data
.
use_posy
=
TRUE
;
options
.
data
.
posy
=
atoi
(
geom
[
2
]);
}
}
}
else
{
geom
=
g_strsplit_set
(
options
.
data
.
geometry
,
"x+-"
,
4
);
if
(
geom
[
0
])
{
options
.
data
.
width
=
atoi
(
geom
[
0
]);
if
(
geom
[
1
])
{
options
.
data
.
height
=
atoi
(
geom
[
1
]);
if
(
geom
[
2
])
{
options
.
data
.
use_posx
=
TRUE
;
options
.
data
.
posx
=
atoi
(
geom
[
2
]);
if
(
geom
[
3
])
{
options
.
data
.
use_posy
=
TRUE
;
options
.
data
.
posy
=
atoi
(
geom
[
3
]);
}
}
}
}
}
g_strfreev
(
geom
);
}
gtk_widget_set_size_request
(
dlg
,
options
.
data
.
width
,
options
.
data
.
height
);
gtk_widget_set_size_request
(
dlg
,
options
.
data
.
width
,
options
.
data
.
height
);
gtk_window_set_resizable
(
GTK_WINDOW
(
dlg
),
!
options
.
data
.
fixed
);
gtk_window_set_resizable
(
GTK_WINDOW
(
dlg
),
!
options
.
data
.
fixed
);
...
...
src/util.c
View file @
c5de754e
...
@@ -576,6 +576,59 @@ check_complete (GtkEntryCompletion *c, const gchar *key, GtkTreeIter *iter, gpoi
...
@@ -576,6 +576,59 @@ check_complete (GtkEntryCompletion *c, const gchar *key, GtkTreeIter *iter, gpoi
return
found
;
return
found
;
}
}
void
parse_geometry
()
{
gchar
*
geom
,
*
ptr
;
gint
w
=
-
1
,
h
=
-
1
,
x
=
0
,
y
=
0
;
gboolean
usexy
=
FALSE
;
guint
i
=
0
;
if
(
!
options
.
data
.
geometry
)
return
;
geom
=
options
.
data
.
geometry
;
if
(
geom
[
i
]
!=
'+'
&&
geom
[
i
]
!=
'-'
)
{
ptr
=
geom
+
i
;
w
=
atoi
(
ptr
);
while
(
geom
[
i
]
&&
geom
[
i
]
!=
'x'
)
i
++
;
if
(
!
geom
[
i
])
return
;
ptr
=
geom
+
i
+
1
;
h
=
atoi
(
ptr
);
while
(
geom
[
i
]
&&
geom
[
i
]
!=
'-'
&&
geom
[
i
]
!=
'+'
)
i
++
;
}
if
(
geom
[
i
])
{
usexy
=
TRUE
;
ptr
=
geom
+
i
;
x
=
atoi
(
ptr
);
i
++
;
while
(
geom
[
i
]
&&
geom
[
i
]
!=
'-'
&&
geom
[
i
]
!=
'+'
)
i
++
;
if
(
!
geom
[
i
])
return
;
ptr
=
geom
+
i
;
y
=
atoi
(
ptr
);
}
options
.
data
.
width
=
w
;
options
.
data
.
height
=
h
;
options
.
data
.
posx
=
x
;
options
.
data
.
posy
=
y
;
options
.
data
.
use_posx
=
options
.
data
.
use_posy
=
usexy
;
}
#ifdef HAVE_SPELL
#ifdef HAVE_SPELL
void
void
show_langs
()
show_langs
()
...
...
src/yad.h
View file @
c5de754e
...
@@ -629,6 +629,8 @@ gchar *escape_char (gchar *str, gchar ch);
...
@@ -629,6 +629,8 @@ gchar *escape_char (gchar *str, gchar ch);
gboolean
check_complete
(
GtkEntryCompletion
*
c
,
const
gchar
*
key
,
GtkTreeIter
*
iter
,
gpointer
data
);
gboolean
check_complete
(
GtkEntryCompletion
*
c
,
const
gchar
*
key
,
GtkTreeIter
*
iter
,
gpointer
data
);
void
parse_geometry
();
#ifdef HAVE_SPELL
#ifdef HAVE_SPELL
void
show_langs
();
void
show_langs
();
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment