mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-10 12:16:24 +01:00
Clean up
This commit is contained in:
parent
be73995f42
commit
ba9ece2bd3
1 changed files with 9 additions and 9 deletions
|
@ -99,7 +99,7 @@ zathura_rectangle_t
|
||||||
zathura_link_get_position(zathura_link_t* link)
|
zathura_link_get_position(zathura_link_t* link)
|
||||||
{
|
{
|
||||||
if (link == NULL) {
|
if (link == NULL) {
|
||||||
zathura_rectangle_t position = { 0, 0, 0, 0 };
|
const zathura_rectangle_t position = { 0, 0, 0, 0 };
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ zathura_link_target_t
|
||||||
zathura_link_get_target(zathura_link_t* link)
|
zathura_link_get_target(zathura_link_t* link)
|
||||||
{
|
{
|
||||||
if (link == NULL) {
|
if (link == NULL) {
|
||||||
zathura_link_target_t target = { 0, NULL, 0, 0, 0, 0, 0, 0 };
|
const zathura_link_target_t target = { 0, NULL, 0, 0, 0, 0, 0, 0 };
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,22 +163,22 @@ link_goto_dest(zathura_t* zathura, const zathura_link_t* link)
|
||||||
girara_setting_get(zathura->ui.session, "link-hadjust", &link_hadjust);
|
girara_setting_get(zathura->ui.session, "link-hadjust", &link_hadjust);
|
||||||
|
|
||||||
/* scale and rotate */
|
/* scale and rotate */
|
||||||
double scale = zathura_document_get_scale(zathura->document);
|
const double scale = zathura_document_get_scale(zathura->document);
|
||||||
double shiftx = link->target.left * scale / (double)cell_width;
|
double shiftx = link->target.left * scale / cell_width;
|
||||||
double shifty = link->target.top * scale / (double)cell_height;
|
double shifty = link->target.top * scale / cell_height;
|
||||||
page_calc_position(zathura->document, shiftx, shifty, &shiftx, &shifty);
|
page_calc_position(zathura->document, shiftx, shifty, &shiftx, &shifty);
|
||||||
|
|
||||||
/* shift the position or set to auto */
|
/* shift the position or set to auto */
|
||||||
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
|
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
|
||||||
link->target.left != -1 && link_hadjust == true) {
|
link->target.left != -1 && link_hadjust == true) {
|
||||||
pos_x += shiftx / (double)doc_width;
|
pos_x += shiftx / doc_width;
|
||||||
} else {
|
} else {
|
||||||
pos_x = -1; /* -1 means automatic */
|
pos_x = -1; /* -1 means automatic */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
|
if (link->target.destination_type == ZATHURA_LINK_DESTINATION_XYZ &&
|
||||||
link->target.top != -1) {
|
link->target.top != -1) {
|
||||||
pos_y += shifty / (double)doc_height;
|
pos_y += shifty / doc_height;
|
||||||
} else {
|
} else {
|
||||||
pos_y = -1; /* -1 means automatic */
|
pos_y = -1; /* -1 means automatic */
|
||||||
}
|
}
|
||||||
|
@ -223,10 +223,10 @@ link_launch(zathura_t* zathura, const zathura_link_t* link)
|
||||||
/* get file path */
|
/* get file path */
|
||||||
if (link->target.value == NULL) {
|
if (link->target.value == NULL) {
|
||||||
return;
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
const char* document = zathura_document_get_path(zathura->document);
|
const char* document = zathura_document_get_path(zathura->document);
|
||||||
char* dir = g_path_get_dirname(document);
|
char* dir = g_path_get_dirname(document);
|
||||||
|
|
||||||
if (girara_xdg_open_with_working_directory(link->target.value, dir) == false) {
|
if (girara_xdg_open_with_working_directory(link->target.value, dir) == false) {
|
||||||
girara_notify(zathura->ui.session, GIRARA_ERROR, _("Failed to run xdg-open."));
|
girara_notify(zathura->ui.session, GIRARA_ERROR, _("Failed to run xdg-open."));
|
||||||
|
|
Loading…
Reference in a new issue