Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Gagis committed Jan 9, 2024
1 parent 45864fa commit af06937
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ define mordavokne_rules

this_name := mordavokne-$1

this_cxxflags += $(shell pkg-config --cflags gdk-3.0)
# use -isystem instead of -I to prevent clang-tidy follow the includes from these locations
this_cxxflags += $(patsubst -I%,-isystem%,$(shell pkg-config --cflags gdk-3.0))
this_ldlibs += $(shell pkg-config --libs gdk-3.0)

ifeq ($(os), linux)
Expand Down
8 changes: 6 additions & 2 deletions src/mordavokne/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@ void application::hide_virtual_keyboard() noexcept {

morda::real application::get_pixels_per_pp(r4::vector2<unsigned> resolution, r4::vector2<unsigned> screen_size_mm)
{
utki::log([&](auto&o){o << "screen resolution = " << resolution << std::endl;});
utki::log([&](auto&o){o << "physical screen size, mm = " << screen_size_mm << std::endl;});
utki::log([&](auto& o) {
o << "screen resolution = " << resolution << std::endl;
});
utki::log([&](auto& o) {
o << "physical screen size, mm = " << screen_size_mm << std::endl;
});

// NOTE: for ordinary desktop displays the DP size should be equal to 1 pixel.
// For high density displays it should be more than one pixel, depending on
Expand Down
20 changes: 13 additions & 7 deletions src/mordavokne/glue/linux/glue.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/cursorfont.h>
#include <gdk/gdk.h>
#include <nitki/queue.hpp>
#include <opros/wait_set.hpp>
#include <papki/fs_file.hpp>
#include <utki/string.hpp>
#include <utki/unicode.hpp>
#include <gdk/gdk.h>

#ifdef MORDAVOKNE_RENDER_OPENGL
# include <GL/glew.h>
Expand Down Expand Up @@ -594,7 +594,8 @@ struct window_wrapper : public utki::destructable {
}
} else {
std::cout << "none of GLX_EXT_swap_control, GLX_MESA_swap_control GLX "
"extensions are supported" << std::endl;
"extensions are supported"
<< std::endl;
}

// sync to ensure any errors generated are processed
Expand Down Expand Up @@ -837,17 +838,21 @@ morda::real get_dots_per_pp(window_wrapper& ww)
// utki::assert(mon, SL);
// int sf = gdk_monitor_get_scale_factor(mon);

int sf = gdk_window_get_scale_factor (gdk_get_default_root_window ());
int sf = gdk_window_get_scale_factor(gdk_get_default_root_window());

std::cout << "scale factor = " << sf << std::endl;



int src_num = 0;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-bounds-pointer-arithmetic)
r4::vector2<unsigned> resolution(DisplayWidth(ww.display.display, src_num), DisplayHeight(ww.display.display, src_num));
r4::vector2<unsigned> resolution(
DisplayWidth(ww.display.display, src_num),
DisplayHeight(ww.display.display, src_num)
);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-cstyle-cast, cppcoreguidelines-pro-bounds-pointer-arithmetic)
r4::vector2<unsigned> screen_size_mm(DisplayWidthMM(ww.display.display, src_num), DisplayHeightMM(ww.display.display, src_num));
r4::vector2<unsigned> screen_size_mm(
DisplayWidthMM(ww.display.display, src_num),
DisplayHeightMM(ww.display.display, src_num)
);

return application::get_pixels_per_pp(resolution, screen_size_mm);
}
Expand Down Expand Up @@ -1251,6 +1256,7 @@ int main(int argc, const char** argv)
{
{
auto c = argc;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-const-cast)
auto p = const_cast<char**>(argv);
gdk_init(&c, &p);
}
Expand Down

0 comments on commit af06937

Please sign in to comment.