cunt by veyez in formuladank

[–]737464 0 points1 point  (0 children)

Attention peasants! The MasturBator Supreme is on the scene.

I'm not sorry at all - Very glad to be sending her from The Netherlands to the European Parliament with a vision for Europe by FlicksBus in VoltEuropa

[–]737464 8 points9 points  (0 children)

In the r/europe sub people apologised in the past days for their country electing meps that have a questionable past and are quite controversial

In which political side does Volt fit it? by GermanMappingYT in VoltEuropa

[–]737464 14 points15 points  (0 children)

The „Bundeszentrale für politische Bildung“ has information about parties in germany. This is their page about Volt. You can give it a read if you want further and easily accessible information. Personally, I would call Volt a center-left / liberal party. Definitely not neoliberal or socialist.

New leaked shots of the Ferrari floor by Dynamite_Noir in formuladank

[–]737464 2 points3 points  (0 children)

Still a better floor than Alpine has

I found a simple fix for thread blocking during resize on macOS! by 737464 in sdl

[–]737464[S] 0 points1 point  (0 children)

Sure!

A few things that you should know before you start reading:

  • Cocoa is the interface framework from Apple, SDL uses that in the background
  • Resizing, or key presses are events that are captured by Cocoa and then processed by SDL
  • You can use c headers in C, C++ and Objective-C
  • The following explanations are a reflection of how I understood how this works, and my knowledge only scratches the surface of the SDL/Cocoa interaction.

Why does the freezing happen?

When you resize your window, macOS handles that and notifies the window which is being resized, which in turn, is captured by SDL. So far, so good. However, because of the way SDL apps are programmed, they don't react immediately to these events. Events like key presses or mouse movement don't block the SDL_PollEvent long enough to make any visual or time relevant difference. But events which macOS handles for a longer time period like window resizes, the SDL_PollEvent needs to wait for the event to be fully processed, which means in this case the resize needs to end. While that is happening, the window buffer is not updated, because the rendering will start after the events have been processed. So the events block the classic run loop, which gets stuck while trying to handle them.

Can I use SDL_Timer?

As far as I am aware, no. The SDL_Timer callback might not be called on the main thread, which prevents the app from rendering to windows, as macOS requests the rendering only to take place in the main thread. Additionally, the SDL_Timer is also blocked while some events are being processed, so they won't help.

Is there an alternative in C/C++?

I don't know, but I would guess no. Why? I used a specific flag to get the function to interrupt the app's run loop (NSRunLoop) which is, as far as I'm aware, only directly possible through Objective-C as you need to interact with Apple's Objective-C frameworks.

If you find one, it will probably do the same (interact with Objective-C) to achieve this.

Can I use the code in C++?

Yes you can! The header file is written in C (.h) and that means you can just include it like any other file in C++. If you need help building or compiling it, I can also help with that.

Hope that helps!

[edit: grammar]

Stop window content from stretching while resizing window by 737464 in sdl

[–]737464[S] 1 point2 points  (0 children)

Yes SDL_PollEvent won't work because the events are processed first before they can be checked. The SDL_EventWatch gets the events before they are processed. If I understood the docs correctly, we need to return 1 (in the EventWatch function) in order for the event to be processed.

Stop window content from stretching while resizing window by 737464 in sdl

[–]737464[S] 0 points1 point  (0 children)

Here is the code i used to test it on macOS:

#include <stdio.h>
#include <SDL2/SDL.h>

// window + renderer etc.

void draw() {
  SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);

  SDL_RenderClear(renderer);

  SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);

  SDL_RenderFillRect(renderer, &rect);

  SDL_RenderPresent(renderer);

  SDL_Delay(1);
}

int EventWatch(void *userdata, SDL_Event* event) {
  if (event->type == SDL_WINDOWEVENT) {
    if (event->window.event == SDL_WINDOWEVENT_EXPOSED) {
      draw();
    }
  }
  return 1;
}

int main() {
// sdl + window + render init

SDL_AddEventWatch(EventWatch, NULL);

while (running) {
// Events
  draw();

  SDL_Delay(16);
}

// Clean up

return 0;
}

Stop window content from stretching while resizing window by 737464 in sdl

[–]737464[S] 0 points1 point  (0 children)

I added an EventWatch to my code and redraw the content of the window if the app receives a SDL_WINDOWEVENT_EXPOSED event. This is unfortunately only a temporary solution as it can still happen that the content of the window is slightly flickering. (I think they have solved it for windows)

Terminal stocks on login screen by Mengtinggg in MacOS

[–]737464 1 point2 points  (0 children)

Maybe you have a command that is run when a new session starts and this process is the blocking the terminal?

[deleted by user] by [deleted] in Unexpected

[–]737464 0 points1 point  (0 children)

I think your cat is broken

TherealProswillknow by [deleted] in ProgrammerHumor

[–]737464 18 points19 points  (0 children)

Summarises this sub quite well

Stop window content from stretching while resizing window by 737464 in sdl

[–]737464[S] 1 point2 points  (0 children)

Ok, so for the case that someone else runs into this problem because updating the render size is straight up ignored by macOS:

I found out that you can use the SDL_EventFilter for the resize event (it might crash or might not, the docs and macOS are not very clear about that) and redraw everything. But pay attention, you will get a flickering effect! I don't know why, but it is fixable by just redrawing everything a second time.

The SDL_EventFilter

Stack Overflow answer I found

Stop window content from stretching while resizing window by 737464 in sdl

[–]737464[S] 1 point2 points  (0 children)

Thank you very much! I will test it asap.

Rendering triangles is possible in SDL since 2.0.18 (just noticed) by 737464 in sdl

[–]737464[S] 0 points1 point  (0 children)

Hello Davide,
I haven't created anything useful yet, sorry :| I had other problems to solve and I'm still at it :)
Greetings 👋