Skip to content

Commit

Permalink
Merge pull request #197 from demoj1/master
Browse files Browse the repository at this point in the history
Add ui window height and width parameter to config
  • Loading branch information
nakst authored Mar 9, 2025
2 parents 70241a9 + 67eb82e commit 12f2ad2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ You can use any standard GDB command, or any of the commands listed in "Special

### User interface

You can change the font and user interface scaling in the `[ui]` section. For example,
You can change the font, user interface scaling, window width and height in the `[ui]` section. For example,

```ini
[ui]
scale=1.5
font_path=/usr/share/fonts/TTF/DejaVuSansMono.ttf
font_size_interface=17
font_size_code=20
width=800
height=600
```

To change the font, FreeType must have been available when you compiled gf. You can enable subpixel font rendering by recompiling with `extra_flags=-DUI_FREETYPE_SUBPIXEL ./build.sh`.
Expand Down
8 changes: 7 additions & 1 deletion gf2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ const char *fontPath;
int fontSizeCode = 13;
int fontSizeInterface = 11;
float uiScale = 1;
int uiWidth = 800;
int uiHeight = 600;
bool selectableSource;
bool restoreWatchWindow;
struct WatchWindow *firstWatchWindow;
Expand Down Expand Up @@ -1278,6 +1280,10 @@ void SettingsLoad(bool earlyPass) {
fontSizeInterface = atoi(state.value);
} else if (0 == strcmp(state.key, "scale")) {
uiScale = atof(state.value);
} else if (0 == strcmp(state.key, "width")) {
uiWidth = atoi(state.value);
} else if (0 == strcmp(state.key, "height")) {
uiHeight = atoi(state.value);
} else if (0 == strcmp(state.key, "layout")) {
layoutString = state.value;
} else if (0 == strcmp(state.key, "maximize")) {
Expand Down Expand Up @@ -1855,7 +1861,7 @@ int GfMain(int argc, char **argv) {
fontCode = UIFontCreate(fontPath, fontSizeCode);
UIFontActivate(UIFontCreate(fontPath, fontSizeInterface));

windowMain = UIWindowCreate(0, maximize ? UI_WINDOW_MAXIMIZE : 0, "gf2", 0, 0);
windowMain = UIWindowCreate(0, maximize ? UI_WINDOW_MAXIMIZE : 0, "gf2", uiWidth, uiHeight);
windowMain->scale = uiScale;
windowMain->e.messageUser = WindowMessage;

Expand Down

0 comments on commit 12f2ad2

Please sign in to comment.